]> git.baikalelectronics.ru Git - kernel.git/commit
cpufreq: Mark policy->governor = NULL for inactive policies
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 12 May 2015 06:52:51 +0000 (12:22 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 15 May 2015 00:46:45 +0000 (02:46 +0200)
commit75ccbf809d6e137c8626c309ef267949fc23d902
treeca480f2d5808574d85711b1be1872cf3a7ba01f7
parent660237253928acceb1e77813207a53a53b61551d
cpufreq: Mark policy->governor = NULL for inactive policies

Later commits would change the way policies are managed today. Policies
wouldn't be freed on cpu hotplug (currently they aren't freed on
suspend), and while the CPU is offline, the sysfs cpufreq files would
still be present.

Because we don't mark policy->governor as NULL, it still contains
pointer of the last used governor. And if the governor is removed, while
all the CPUs of a policy are hotplugged out, this pointer wouldn't be
valid anymore. And if we try to read the 'scaling_governor', etc.  from
sysfs, it will result in kernel OOPs.

To prevent this, mark policy->governor as NULL for all inactive policies
while the governor is removed from kernel.

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