diff mbox series

MIPS: Loongson: Fix return value of loongson_hwmon_init

Message ID 1572874430-28903-1-git-send-email-yangtiezhu@loongson.cn (mailing list archive)
State Mainlined
Commit dece3c2a320b0a6d891da6ff774ab763969b6860
Delegated to: Paul Burton
Headers show
Series MIPS: Loongson: Fix return value of loongson_hwmon_init | expand

Commit Message

Tiezhu Yang Nov. 4, 2019, 1:33 p.m. UTC
When call function hwmon_device_register failed, use the actual
return value instead of always -ENOMEM.

Fixes: 64f09aa967e1 ("MIPS: Loongson-3: Add CPU Hwmon platform driver")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 drivers/platform/mips/cpu_hwmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul Burton Nov. 4, 2019, 7:06 p.m. UTC | #1
Hello,

Tiezhu Yang wrote:
> When call function hwmon_device_register failed, use the actual
> return value instead of always -ENOMEM.

Applied to mips-next.

> commit dece3c2a320b
> https://git.kernel.org/mips/c/dece3c2a320b
> 
> Fixes: 64f09aa967e1 ("MIPS: Loongson-3: Add CPU Hwmon platform driver")
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> Signed-off-by: Paul Burton <paulburton@kernel.org>

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paulburton@kernel.org to report it. ]
diff mbox series

Patch

diff --git a/drivers/platform/mips/cpu_hwmon.c b/drivers/platform/mips/cpu_hwmon.c
index 1833b51..0d27cb7 100644
--- a/drivers/platform/mips/cpu_hwmon.c
+++ b/drivers/platform/mips/cpu_hwmon.c
@@ -176,7 +176,7 @@  static int __init loongson_hwmon_init(void)
 
 	cpu_hwmon_dev = hwmon_device_register(NULL);
 	if (IS_ERR(cpu_hwmon_dev)) {
-		ret = -ENOMEM;
+		ret = PTR_ERR(cpu_hwmon_dev);
 		pr_err("hwmon_device_register fail!\n");
 		goto fail_hwmon_device_register;
 	}