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: ee17525907 ("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>
This commit is contained in:
Rafael J. Wysocki 2026-05-11 21:56:14 +02:00 committed by Guenter Roeck
parent 793d2a057f
commit f06035ab32

View 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;