cpufreq: Clear policy->cpus bits in __cpufreq_remove_dev_finish()
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 12 Sep 2013 11:36:33 +0000 (17:06 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 17 Sep 2013 22:01:27 +0000 (00:01 +0200)
commit9c8f1ee40b6368e6b2775c9c9f816e2a5dca3c07
tree40ecbfa5c590cb9b04f13ec9f62ac6a209233834
parent272b98c6455f00884f0350f775c5342358ebb73f
cpufreq: Clear policy->cpus bits in __cpufreq_remove_dev_finish()

This broke after a recent change "cedb70a cpufreq: Split __cpufreq_remove_dev()
into two parts" from Srivatsa.

Consider a scenario where we have two CPUs in a policy (0 & 1) and we are
removing CPU 1. On the call to __cpufreq_remove_dev_prepare() we have cleared 1
from policy->cpus and now on a call to __cpufreq_remove_dev_finish() we read
cpumask_weight of policy->cpus, which will come as 1 and this code will behave
as if we are removing the last CPU from policy :)

Fix it by clearing the CPU mask in __cpufreq_remove_dev_finish() instead of
__cpufreq_remove_dev_prepare().

Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c