Skip to content

Commit ab743c6

Browse files
rafaeljwij-intel
authored andcommitted
platform/x86: fujitsu-tablet: 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 requisite ACPI_COMPANION() checks against NULL to the platform/x86 fujitsu-tablet driver. Fixes: bd13b26 ("platform/x86: fujitsu-tablet: 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/10861611.nUPlyArG6x@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 e99829a commit ab743c6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/platform/x86/fujitsu-tablet.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,14 @@ static acpi_status fujitsu_walk_resources(struct acpi_resource *res, void *data)
445445

446446
static int acpi_fujitsu_probe(struct platform_device *pdev)
447447
{
448-
struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
448+
struct acpi_device *adev;
449449
acpi_status status;
450450
int error;
451451

452+
adev = ACPI_COMPANION(&pdev->dev);
453+
if (!adev)
454+
return -ENODEV;
455+
452456
status = acpi_walk_resources(adev->handle, METHOD_NAME__CRS,
453457
fujitsu_walk_resources, NULL);
454458
if (ACPI_FAILURE(status) || !fujitsu.irq || !fujitsu.io_base)

0 commit comments

Comments
 (0)