Skip to content

Commit 4840f8b

Browse files
rafaeljwij-intel
authored andcommitted
platform/x86: toshiba_haps: 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 toshiba_haps driver. Fixes: 3a96c79 ("platform/x86: toshiba_haps: 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/2285136.Mh6RI2rZIc@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 48b06ff commit 4840f8b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/platform/x86/toshiba_haps.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,17 @@ static int toshiba_haps_available(acpi_handle handle)
182182

183183
static int toshiba_haps_probe(struct platform_device *pdev)
184184
{
185-
struct acpi_device *acpi_dev = ACPI_COMPANION(&pdev->dev);
186185
struct toshiba_haps_dev *haps;
186+
struct acpi_device *acpi_dev;
187187
int ret;
188188

189189
if (toshiba_haps)
190190
return -EBUSY;
191191

192+
acpi_dev = ACPI_COMPANION(&pdev->dev);
193+
if (!acpi_dev)
194+
return -ENODEV;
195+
192196
if (!toshiba_haps_available(acpi_dev->handle))
193197
return -ENODEV;
194198

0 commit comments

Comments
 (0)