mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
platform/chrome: wilco_ec: event: Check ACPI_COMPANION()
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
wilco_ec event driver.
Fixes: 27d58498f6 ("platform/chrome: wilco_ec: event: Convert to a platform driver")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/2076666.usQuhbGJ8B@rafael.j.wysocki
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
This commit is contained in:
parent
c15dbae7c8
commit
51dcff9796
|
|
@ -452,8 +452,13 @@ static void hangup_device(struct event_device_data *dev_data)
|
|||
static int event_device_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct event_device_data *dev_data;
|
||||
struct acpi_device *adev;
|
||||
int error, minor;
|
||||
|
||||
adev = ACPI_COMPANION(&pdev->dev);
|
||||
if (!adev)
|
||||
return -ENODEV;
|
||||
|
||||
minor = ida_alloc_max(&event_ida, EVENT_MAX_DEV-1, GFP_KERNEL);
|
||||
if (minor < 0) {
|
||||
error = minor;
|
||||
|
|
@ -494,8 +499,7 @@ static int event_device_probe(struct platform_device *pdev)
|
|||
goto free_dev_data;
|
||||
|
||||
/* Install an ACPI notify handler. */
|
||||
error = acpi_dev_install_notify_handler(ACPI_COMPANION(&pdev->dev),
|
||||
ACPI_DEVICE_NOTIFY,
|
||||
error = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
|
||||
event_device_notify, &pdev->dev);
|
||||
if (error)
|
||||
goto free_cdev;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user