OSDN Git Service

MIPS: Loongson: Fix return value of loongson_hwmon_init
authorTiezhu Yang <yangtiezhu@loongson.cn>
Mon, 4 Nov 2019 13:33:50 +0000 (21:33 +0800)
committerPaul Burton <paulburton@kernel.org>
Mon, 4 Nov 2019 18:50:55 +0000 (10:50 -0800)
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>
Signed-off-by: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
drivers/platform/mips/cpu_hwmon.c

index 1833b51..0d27cb7 100644 (file)
@@ -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;
        }