Skip to content

Commit 53a8f95

Browse files
rafaeljwij-intel
authored andcommitted
platform/x86: wireless-hotkey: 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 wireless-hotkey driver. Fixes: 8507277 ("platform/x86: wireless-hotkey: 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/3899916.MHq7AAxBmi@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 4840f8b commit 53a8f95

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

drivers/platform/x86/wireless-hotkey.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,14 @@ static void wl_notify(acpi_handle handle, u32 event, void *data)
8989

9090
static int wl_probe(struct platform_device *pdev)
9191
{
92+
struct acpi_device *adev;
9293
struct wl_button *button;
9394
int err;
9495

96+
adev = ACPI_COMPANION(&pdev->dev);
97+
if (!adev)
98+
return -ENODEV;
99+
95100
button = kzalloc_obj(struct wl_button);
96101
if (!button)
97102
return -ENOMEM;
@@ -104,8 +109,8 @@ static int wl_probe(struct platform_device *pdev)
104109
kfree(button);
105110
return err;
106111
}
107-
err = acpi_dev_install_notify_handler(ACPI_COMPANION(&pdev->dev),
108-
ACPI_DEVICE_NOTIFY, wl_notify, button);
112+
err = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
113+
wl_notify, button);
109114
if (err) {
110115
pr_err("Failed to install ACPI notify handler\n");
111116
wireless_input_destroy(&pdev->dev);

0 commit comments

Comments
 (0)