]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: (asus_atk0110) Check ACPI_COMPANION() against NULL
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 11 May 2026 19:56:14 +0000 (21:56 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 12 May 2026 18:33:08 +0000 (11:33 -0700)
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: ee1752590733 ("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>
drivers/hwmon/asus_atk0110.c

index 5688ff5f7c28d8dea07931af98a8dee6be1c5777..109318b0434d99b6d410a63c4430fedc173f0a9f 100644 (file)
@@ -1273,15 +1273,20 @@ static int atk_probe(struct platform_device *pdev)
        struct acpi_buffer buf;
        union acpi_object *obj;
        struct atk_data *data;
+       acpi_handle handle;
 
        dev_dbg(&pdev->dev, "adding...\n");
 
+       handle = ACPI_HANDLE(&pdev->dev);
+       if (!handle)
+               return -ENODEV;
+
        data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
        if (!data)
                return -ENOMEM;
 
        data->dev = &pdev->dev;
-       data->atk_handle = ACPI_HANDLE(&pdev->dev);
+       data->atk_handle = handle;
        INIT_LIST_HEAD(&data->sensor_list);
        data->disable_ec = false;