The cpu online callback returns success unconditionally even when the
device has no support, micro code mismatches or device allocation fails.
Only if CPU_HOTPLUG is disabled, the init function checks whether the
device list is empty and removes the driver.
This does not make sense. If CPU HOTPLUG is enabled then there is no point
to keep the driver around when it failed to initialize on the already
online cpus. The chance that not yet online CPUs will provide a functional
interface later is very close to zero.
Add proper error return codes, so the setup of the cpu hotplug states fails
when the device cannot be initialized and remove all the magic cruft.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* without thermal sensors will be filtered out.
*/
if (!cpu_has(c, X86_FEATURE_DTHERM))
* without thermal sensors will be filtered out.
*/
if (!cpu_has(c, X86_FEATURE_DTHERM))
if (!pdev) {
/* Check the microcode version of the CPU */
if (chk_ucode_version(cpu))
if (!pdev) {
/* Check the microcode version of the CPU */
if (chk_ucode_version(cpu))
/*
* Alright, we have DTS support.
/*
* Alright, we have DTS support.
*/
err = coretemp_device_add(cpu);
if (err)
*/
err = coretemp_device_add(cpu);
if (err)
pdev = coretemp_get_pdev(cpu);
/*
pdev = coretemp_get_pdev(cpu);
/*
err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "hwmon/coretemp:online",
coretemp_cpu_online, coretemp_cpu_offline);
if (err < 0)
err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "hwmon/coretemp:online",
coretemp_cpu_online, coretemp_cpu_offline);
if (err < 0)
- goto exit_driver_unreg;
coretemp_hp_online = err;
coretemp_hp_online = err;
-
-#ifndef CONFIG_HOTPLUG_CPU
- if (list_empty(&pdev_list)) {
- err = -ENODEV;
- goto exit_hp_unreg;
- }
-#endif
- put_online_cpus();
-#ifndef CONFIG_HOTPLUG_CPU
-exit_hp_unreg:
- cpuhp_remove_state(coretemp_hp_online);
- put_online_cpus();
-#endif
-exit_driver_unreg:
platform_driver_unregister(&coretemp_driver);
return err;
}
platform_driver_unregister(&coretemp_driver);
return err;
}