Skip to content

Commit f06035a

Browse files
rafaeljwgroeck
authored andcommitted
hwmon: (asus_atk0110) 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_HANDLE() check against NULL to the asus_atk0110 hwmon driver. Fixes: ee17525 ("hwmon: (asus_atk0110) Convert ACPI driver to a platform one") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/2261594.irdbgypaU6@rafael.j.wysocki Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 793d2a0 commit f06035a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

drivers/hwmon/asus_atk0110.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,15 +1273,20 @@ static int atk_probe(struct platform_device *pdev)
12731273
struct acpi_buffer buf;
12741274
union acpi_object *obj;
12751275
struct atk_data *data;
1276+
acpi_handle handle;
12761277

12771278
dev_dbg(&pdev->dev, "adding...\n");
12781279

1280+
handle = ACPI_HANDLE(&pdev->dev);
1281+
if (!handle)
1282+
return -ENODEV;
1283+
12791284
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
12801285
if (!data)
12811286
return -ENOMEM;
12821287

12831288
data->dev = &pdev->dev;
1284-
data->atk_handle = ACPI_HANDLE(&pdev->dev);
1289+
data->atk_handle = handle;
12851290
INIT_LIST_HEAD(&data->sensor_list);
12861291
data->disable_ec = false;
12871292

0 commit comments

Comments
 (0)