diff options
| -rw-r--r-- | drivers/hwmon/coretemp.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 984c02334910..c364bfd92d23 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
| @@ -662,12 +662,12 @@ static int coretemp_cpu_online(unsigned int cpu) | |||
| 662 | * without thermal sensors will be filtered out. | 662 | * without thermal sensors will be filtered out. |
| 663 | */ | 663 | */ |
| 664 | if (!cpu_has(c, X86_FEATURE_DTHERM)) | 664 | if (!cpu_has(c, X86_FEATURE_DTHERM)) |
| 665 | return 0; | 665 | return -ENODEV; |
| 666 | 666 | ||
| 667 | if (!pdev) { | 667 | if (!pdev) { |
| 668 | /* Check the microcode version of the CPU */ | 668 | /* Check the microcode version of the CPU */ |
| 669 | if (chk_ucode_version(cpu)) | 669 | if (chk_ucode_version(cpu)) |
| 670 | return 0; | 670 | return -EINVAL; |
| 671 | 671 | ||
| 672 | /* | 672 | /* |
| 673 | * Alright, we have DTS support. | 673 | * Alright, we have DTS support. |
| @@ -677,7 +677,7 @@ static int coretemp_cpu_online(unsigned int cpu) | |||
| 677 | */ | 677 | */ |
| 678 | err = coretemp_device_add(cpu); | 678 | err = coretemp_device_add(cpu); |
| 679 | if (err) | 679 | if (err) |
| 680 | return 0; | 680 | return err; |
| 681 | 681 | ||
| 682 | pdev = coretemp_get_pdev(cpu); | 682 | pdev = coretemp_get_pdev(cpu); |
| 683 | /* | 683 | /* |
| @@ -782,28 +782,14 @@ static int __init coretemp_init(void) | |||
| 782 | if (err) | 782 | if (err) |
| 783 | return err; | 783 | return err; |
| 784 | 784 | ||
| 785 | get_online_cpus(); | ||
| 786 | err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "hwmon/coretemp:online", | 785 | err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "hwmon/coretemp:online", |
| 787 | coretemp_cpu_online, coretemp_cpu_offline); | 786 | coretemp_cpu_online, coretemp_cpu_offline); |
| 788 | if (err < 0) | 787 | if (err < 0) |
| 789 | goto exit_driver_unreg; | 788 | goto outdrv; |
| 790 | coretemp_hp_online = err; | 789 | coretemp_hp_online = err; |
| 791 | |||
| 792 | #ifndef CONFIG_HOTPLUG_CPU | ||
| 793 | if (list_empty(&pdev_list)) { | ||
| 794 | err = -ENODEV; | ||
| 795 | goto exit_hp_unreg; | ||
| 796 | } | ||
| 797 | #endif | ||
| 798 | put_online_cpus(); | ||
| 799 | return 0; | 790 | return 0; |
| 800 | 791 | ||
| 801 | #ifndef CONFIG_HOTPLUG_CPU | 792 | outdrv: |
| 802 | exit_hp_unreg: | ||
| 803 | cpuhp_remove_state(coretemp_hp_online); | ||
| 804 | put_online_cpus(); | ||
| 805 | #endif | ||
| 806 | exit_driver_unreg: | ||
| 807 | platform_driver_unregister(&coretemp_driver); | 793 | platform_driver_unregister(&coretemp_driver); |
| 808 | return err; | 794 | return err; |
| 809 | } | 795 | } |
