cpufreq: Remove CPU hotplug callbacks only if they were initialized
authorBoris Ostrovsky <boris.ostrovsky@oracle.com>
Thu, 15 Dec 2016 15:00:58 +0000 (10:00 -0500)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 21 Dec 2016 01:52:52 +0000 (02:52 +0100)
Since CPU hotplug callbacks are requested for CPUHP_AP_ONLINE_DYN state,
successful callback initialization will result in cpuhp_setup_state()
returning a positive value. Therefore acpi_cpufreq_online being zero
indicates that callbacks have not been installed.

This means that acpi_cpufreq_boost_exit() should only remove them if
acpi_cpufreq_online is positive. Trying to call
cpuhp_remove_state_nocalls(0) will cause a BUG().

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/acpi-cpufreq.c

index 3a98702b7445f747d9a710f16753d29e312b17a6..3a2ca0f79daf281c5940222f6b9da179b35f64f3 100644 (file)
@@ -930,7 +930,7 @@ static void __init acpi_cpufreq_boost_init(void)
 
 static void acpi_cpufreq_boost_exit(void)
 {
-       if (acpi_cpufreq_online >= 0)
+       if (acpi_cpufreq_online > 0)
                cpuhp_remove_state_nocalls(acpi_cpufreq_online);
 }