summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/cpufreq/cpufreq.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 118dbf1cef44..6ec828805428 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2333,6 +2333,9 @@ static int cpufreq_cpu_callback(struct notifier_block *nfb,
{
unsigned int cpu = (unsigned long)hcpu;
+ if (!cpufreq_driver)
+ return NOTIFY_OK;
+
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_ONLINE:
cpufreq_online(cpu);
@@ -2499,6 +2502,9 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
pr_debug("trying to register driver %s\n", driver_data->name);
+ /* Register for hotplug notifers before blocking hotplug. */
+ register_hotcpu_notifier(&cpufreq_cpu_notifier);
+
/* Protect against concurrent CPU online/offline. */
get_online_cpus();
@@ -2530,7 +2536,6 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
goto err_if_unreg;
}
- register_hotcpu_notifier(&cpufreq_cpu_notifier);
pr_info("driver %s up and running\n", driver_data->name);
out: