summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2014-02-25 14:29:44 +0530
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-03-01 01:39:30 +0100
commitbd0fa9bb455d9b58ec2d7a36cd08afed9e3411b4 (patch)
tree450e9eac17b1d86c277ae27e20d5972147ad5b8f
parent52e7e816420383a340cfb6c3ffd12477c3c80b76 (diff)
downloadlinux-bd0fa9bb455d9b58ec2d7a36cd08afed9e3411b4.tar.gz
linux-bd0fa9bb455d9b58ec2d7a36cd08afed9e3411b4.tar.bz2
linux-bd0fa9bb455d9b58ec2d7a36cd08afed9e3411b4.zip
cpufreq: Return error if ->get() failed in cpufreq_update_policy()
cpufreq_update_policy() calls cpufreq_driver->get() to get current frequency of a CPU and it is not supposed to fail or return zero. Return error in case that happens. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/cpufreq.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 5815af50d3de..56b7b1be352d 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2139,6 +2139,11 @@ int cpufreq_update_policy(unsigned int cpu)
*/
if (cpufreq_driver->get) {
new_policy.cur = cpufreq_driver->get(cpu);
+ if (WARN_ON(!new_policy.cur)) {
+ ret = -EIO;
+ goto no_policy;
+ }
+
if (!policy->cur) {
pr_debug("Driver did not initialize current freq");
policy->cur = new_policy.cur;