Commit 1528c91e authored by Kazuhiro Abe's avatar Kazuhiro Abe Committed by Lifeng Zheng
Browse files

hwmon: (acpi_power_meter) Fix a check for the return value of read_domain_devices().

mainline inclusion
from mainline-v6.13-rc7
commit 8d6bf2e1055fa2cca4bf233f46d4d1e2086cc5ff
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBVB4K
CVE: NA

Reference: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8d6bf2e1055fa2cca4bf233f46d4d1e2086cc5ff



---------------------------------------------------------------------

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: default avatarKazuhiro 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: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarXinghai Cen <cenxinghai@h-partners.com>
parent e13f16ab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -695,7 +695,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) {