]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
x86/hwmon: fix module init for hotplug-but-no-device-found case
authorJan Beulich <jbeulich@novell.com>
Mon, 13 Sep 2010 10:05:51 +0000 (10:05 +0000)
committerGuenter Roeck <guenter.roeck@ericsson.com>
Fri, 24 Sep 2010 18:44:18 +0000 (11:44 -0700)
In commit 0dca94baeab4a1a514841b0a4c8e3a51dfb4d5ae the call to
platform_driver_unregister() was made conditional upon !HOTPLUG_CPU,
but the return value from coretemp_init() was left to indicate an
error. This isn't correct, as the negative return value indicates to
the module loader that initialization failed, which isn't intended
here and results in dangling pointers.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Chen Gong <gong.chen@linux.intel.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
drivers/hwmon/coretemp.c

index de8111114f469ec21567a5781349bb0d7f7cbc98..6b3ef553bd13a5c7d507a5086baace6a0533209f 100644 (file)
@@ -541,16 +541,19 @@ static int __init coretemp_init(void)
                                " has no thermal sensor.\n", c->x86_model);
                }
        }
+
+#ifndef CONFIG_HOTPLUG_CPU
        if (list_empty(&pdev_list)) {
                err = -ENODEV;
                goto exit_driver_unreg;
        }
+#endif
 
        register_hotcpu_notifier(&coretemp_cpu_notifier);
        return 0;
 
-exit_driver_unreg:
 #ifndef CONFIG_HOTPLUG_CPU
+exit_driver_unreg:
        platform_driver_unregister(&coretemp_driver);
 #endif
 exit: