summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2014-02-25 09:59:44 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-03-01 01:39:30 +0100
commitbd0fa9bb455d9b58ec2d7a36cd08afed9e3411b4 (patch)
tree450e9eac17b1d86c277ae27e20d5972147ad5b8f /drivers/cpufreq/cpufreq.c
parentcpufreq: enable ARM drivers on arm64 (diff)
downloadlinux-bd0fa9bb455d9b58ec2d7a36cd08afed9e3411b4.tar.xz
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>
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-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;