Skip to content

Commit

Permalink
x86/hwmon: fix module init for hotplug-but-no-device-found case
Browse files Browse the repository at this point in the history
In commit 0dca94b 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>
  • Loading branch information
Jan Beulich authored and Guenter Roeck committed Sep 24, 2010
1 parent f7c77a3 commit 89a3fd3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/hwmon/coretemp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 89a3fd3

Please sign in to comment.