Hans de Goede 78a18fec52 ACPI: scan: Make acpi_bus_get_device() clear return pointer on error
Set the acpi_device pointer which acpi_bus_get_device() returns-by-
reference to NULL on errors.

We've recently had 2 cases where callers of acpi_bus_get_device()
did not properly error check the return value, so set the returned-
by-reference acpi_device pointer to NULL, because at least some
callers of acpi_bus_get_device() expect that to be done on errors.

[ rjw: This issue was exposed by commit 71da201f38df ("ACPI: scan:
  Defer enumeration of devices with _DEP lists") which caused it to
  be much more likely to occur on some systems, but the real defect
  had been introduced by an earlier commit. ]

Fixes: 40e7fcb19293 ("ACPI: Add _DEP support to fix battery issue on Asus T100TA")
Fixes: bcfcd409d4db ("usb: split code locating ACPI companion into port and device")
Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Diagnosed-by: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: All applicable <stable@vger.kernel.org>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2021-01-20 19:20:20 +01:00
..
2020-11-23 12:50:17 +01:00
2020-11-10 18:52:51 +01:00
2020-10-14 11:42:04 -07:00
2019-06-23 09:23:33 +02:00
2020-10-15 10:46:16 -07:00
2020-11-09 19:08:06 +01:00
2020-12-22 17:59:11 +01:00
2020-10-27 19:30:27 +01:00
2020-11-09 19:08:06 +01:00
2020-11-09 19:25:20 +01:00
2019-11-13 11:12:08 +01:00
2020-11-09 19:08:06 +01:00
2020-12-09 19:10:20 +01:00
2020-12-15 16:39:06 -08:00
2020-11-09 19:08:06 +01:00
2020-11-09 19:08:06 +01:00
2020-07-09 14:09:28 +02:00
2020-10-22 18:58:26 +02:00
2020-11-09 19:08:06 +01:00