drivers: char: Check ACPI_COMPANION() against NULL at probe time
Subsystems (4)
Rafael J. Wysocki
maintainercover drivers: char: Check ACPI_COMPANION() against NULL at probe time
Hi All,
This series fixes up two char drivers recently converted to platform drivers to make them check the devices ACPI companion objects at probe time.
Thanks!
Rafael J. Wysocki
maintainerPATCH 1/2 hpet: Check ACPI_COMPANION() against NULL at probe time
From: "Rafael J. Wysocki" <[email protected]>
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 hpet driver.
--- drivers/char/hpet.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/char/hpet.c +5 -1
@@ -976,10 +976,14 @@ static acpi_status hpet_resources(structstatic int hpet_acpi_probe (struct platform_device *pdev) { -struct acpi_device *device =ACPI_COMPANION (&pdev->dev); +struct acpi_device *device;acpi_status result;struct hpet_data data; + device =ACPI_COMPANION (&pdev->dev); +if (!device) +return -ENODEV ; +memset (&data,0 ,sizeof (data)); result =
Rafael J. Wysocki
maintainerPATCH 2/2 sonypi: Check ACPI_COMPANION() against NULL at probe time
In reply to Rafael J. WysockiFrom: "Rafael J. Wysocki" <[email protected]>
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 sonypi driver.
--- drivers/char/sonypi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/char/sonypi.c +5 -1
@@ -1117,7 +1117,11 @@ static int sonypi_disable(void)#ifdef CONFIG_ACPI static int sonypi_acpi_probe (struct platform_device *pdev) { -struct acpi_device *device =ACPI_COMPANION (&pdev->dev); +struct acpi_device *device; + + device =ACPI_COMPANION (&pdev->dev); +if (!device) +return -ENODEV ; sonypi_acpi_device = device;strcpy (acpi_device_name (device),"Sony laptop hotkeys" );