cpufreq: don't leave stale policy pointer in cdbs->cur_policy
Jacob Shin [Thu, 27 Jun 2013 20:02:12 +0000 (22:02 +0200)]
Clear ->cur_policy when stopping a governor, or the ->cur_policy
pointer may be stale on systems with have_governor_per_policy when a
new policy is allocated due to CPU hotplug offline/online.

[rjw: Changelog]
Suggested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jacob Shin <jacob.shin@amd.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

(cherry picked from commit 419e172145cf6c51d436a8bf4afcd17511f0ff79)
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Change-Id: Iada00880f8c98ed1beb372bf4b84ff9a7d43e3ea
Reviewed-on: http://git-master/r/300402
Reviewed-by: Puneet Saxena <puneets@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/cpufreq/cpufreq_governor.c

index ace35ef..a727267 100644 (file)
@@ -357,6 +357,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
 
                mutex_lock(&dbs_data->mutex);
                mutex_destroy(&cpu_cdbs->timer_mutex);
+               cpu_cdbs->cur_policy = NULL;
 
                mutex_unlock(&dbs_data->mutex);