aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/acpi-cpufreq.c
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2014-01-27 22:50:35 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-01-28 16:36:30 -0500
commiteb8c68ef558e6cba241e7ada54f6b3427cb2bf68 (patch)
treec80171d39e7245f02f60d1b6088124316aa9cc27 /drivers/cpufreq/acpi-cpufreq.c
parent4f11b85a5f2cc279860da3b9977a9586ff2df167 (diff)
acpi-cpufreq: De-register CPU notifier and free struct msr on error.
If cpufreq_register_driver() fails we would free the acpi driver related structures but not free the ones allocated by acpi_cpufreq_boost_init() function. This meant that as the driver error-ed out and a CPU online/offline event came we would crash and burn as one of the CPU notifiers would point to garbage. Fixes: cfc9c8ed03e4 (acpi-cpufreq: Adjust the code to use the common boost attribute) Acked-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/acpi-cpufreq.c')
-rw-r--r--drivers/cpufreq/acpi-cpufreq.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 79e5608e71b5..18448a7e9f86 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -919,7 +919,7 @@ static void __init acpi_cpufreq_boost_init(void)
919 } 919 }
920} 920}
921 921
922static void __exit acpi_cpufreq_boost_exit(void) 922static void acpi_cpufreq_boost_exit(void)
923{ 923{
924 if (msrs) { 924 if (msrs) {
925 unregister_cpu_notifier(&boost_nb); 925 unregister_cpu_notifier(&boost_nb);
@@ -969,9 +969,10 @@ static int __init acpi_cpufreq_init(void)
969 acpi_cpufreq_boost_init(); 969 acpi_cpufreq_boost_init();
970 970
971 ret = cpufreq_register_driver(&acpi_cpufreq_driver); 971 ret = cpufreq_register_driver(&acpi_cpufreq_driver);
972 if (ret) 972 if (ret) {
973 free_acpi_perf_data(); 973 free_acpi_perf_data();
974 974 acpi_cpufreq_boost_exit();
975 }
975 return ret; 976 return ret;
976} 977}
977 978