Skip to content

Commit dc334b9

Browse files
rafaeljwij-intel
authored andcommitted
platform/x86: acer-wireless: 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 acer-wireless driver. Fixes: f7e6480 ("platform/x86: acer-wireless: 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/4746824.LvFx2qVVIh@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 841ff62 commit dc334b9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/platform/x86/acer-wireless.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@ static void acer_wireless_notify(acpi_handle handle, u32 event, void *data)
3737

3838
static int acer_wireless_probe(struct platform_device *pdev)
3939
{
40+
struct acpi_device *adev;
4041
struct input_dev *idev;
4142
int ret;
4243

44+
adev = ACPI_COMPANION(&pdev->dev);
45+
if (!adev)
46+
return -ENODEV;
47+
4348
idev = devm_input_allocate_device(&pdev->dev);
4449
if (!idev)
4550
return -ENOMEM;
@@ -57,8 +62,7 @@ static int acer_wireless_probe(struct platform_device *pdev)
5762
if (ret)
5863
return ret;
5964

60-
return acpi_dev_install_notify_handler(ACPI_COMPANION(&pdev->dev),
61-
ACPI_DEVICE_NOTIFY,
65+
return acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
6266
acer_wireless_notify,
6367
&pdev->dev);
6468
}

0 commit comments

Comments
 (0)