Skip to content

Commit

Permalink
acpi-cpufreq: De-register CPU notifier and free struct msr on error.
Browse files Browse the repository at this point in the history
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: cfc9c8e (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>
  • Loading branch information
Konrad Rzeszutek Wilk authored and Rafael J. Wysocki committed Jan 28, 2014
1 parent 4f11b85 commit eb8c68e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/cpufreq/acpi-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ static void __init acpi_cpufreq_boost_init(void)
}
}

static void __exit acpi_cpufreq_boost_exit(void)
static void acpi_cpufreq_boost_exit(void)
{
if (msrs) {
unregister_cpu_notifier(&boost_nb);
Expand Down Expand Up @@ -969,9 +969,10 @@ static int __init acpi_cpufreq_init(void)
acpi_cpufreq_boost_init();

ret = cpufreq_register_driver(&acpi_cpufreq_driver);
if (ret)
if (ret) {
free_acpi_perf_data();

acpi_cpufreq_boost_exit();
}
return ret;
}

Expand Down

0 comments on commit eb8c68e

Please sign in to comment.