Skip to content

Commit 8148303

Browse files
rafaeljwij-intel
authored andcommitted
platform/x86: eeepc-laptop: Check ACPI_COMPANION() against NULL
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence. Accordingly, add a requisite ACPI_COMPANION() check against NULL to the platform/x86 eeepc-laptop driver. Fixes: 079b59f ("platform/x86: eeepc-laptop: Convert ACPI driver to a platform one") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/3056852.e9J7NaK4W3@rafael.j.wysocki Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 8a17c62 commit 8148303

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/platform/x86/eeepc-laptop.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,10 +1363,14 @@ static bool eeepc_device_present;
13631363

13641364
static int eeepc_acpi_probe(struct platform_device *pdev)
13651365
{
1366-
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
1366+
struct acpi_device *device;
13671367
struct eeepc_laptop *eeepc;
13681368
int result;
13691369

1370+
device = ACPI_COMPANION(&pdev->dev);
1371+
if (!device)
1372+
return -ENODEV;
1373+
13701374
pr_notice(EEEPC_LAPTOP_NAME "\n");
13711375
eeepc = kzalloc_obj(struct eeepc_laptop);
13721376
if (!eeepc)

0 commit comments

Comments
 (0)