]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (acpi_power_meter) Fix a check for the return value of read_domain_devices().
authorKazuhiro Abe <fj1078ii@aa.jp.fujitsu.com>
Wed, 15 Jan 2025 07:35:32 +0000 (07:35 +0000)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 15 Jan 2025 14:21:19 +0000 (06:21 -0800)
After commit fabb1f813ec0 ("hwmon: (acpi_power_meter) Fix fail to load
module on platform without _PMD method"),
the acpi_power_meter driver fails to load if the platform has _PMD method.

To address this, add a check for successful read_domain_devices().
Tested on Nvidia Grace machine.

Fixes: fabb1f813ec0 ("hwmon: (acpi_power_meter) Fix fail to load module on platform without _PMD method")
Signed-off-by: Kazuhiro Abe <fj1078ii@aa.jp.fujitsu.com>
Link: https://lore.kernel.org/r/20250115073532.3211000-1-fj1078ii@aa.jp.fujitsu.com
[groeck: Dropped unnecessary () from expression]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/acpi_power_meter.c

index 2f1c9d97ad2118537355638b13fae948e8a82110..3db1b9d09c32ad94ecf4328808371d67b66291fa 100644 (file)
@@ -682,7 +682,7 @@ static int setup_attrs(struct acpi_power_meter_resource *resource)
 
        /* _PMD method is optional. */
        res = read_domain_devices(resource);
-       if (res != -ENODEV)
+       if (res && res != -ENODEV)
                return res;
 
        if (resource->caps.flags & POWER_METER_CAN_MEASURE) {