cpufreq: update driver_data->flags only if we are registering driver
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 2 Jan 2015 07:04:30 +0000 (12:34 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 23 Jan 2015 21:49:34 +0000 (22:49 +0100)
We should first check if a cpufreq driver is already registered or not
before updating driver_data->flags.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c

index 420f270a04752b1c944a21553e7899429d312d6b..0247da2a3350aa8e08d5cd8228bad825a3efc22d 100644 (file)
@@ -2440,9 +2440,6 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
 
        pr_debug("trying to register driver %s\n", driver_data->name);
 
-       if (driver_data->setpolicy)
-               driver_data->flags |= CPUFREQ_CONST_LOOPS;
-
        write_lock_irqsave(&cpufreq_driver_lock, flags);
        if (cpufreq_driver) {
                write_unlock_irqrestore(&cpufreq_driver_lock, flags);
@@ -2451,6 +2448,9 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
        cpufreq_driver = driver_data;
        write_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
+       if (driver_data->setpolicy)
+               driver_data->flags |= CPUFREQ_CONST_LOOPS;
+
        if (cpufreq_boost_supported()) {
                /*
                 * Check if driver provides function to enable boost -