Commit bd0fa9bb authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki

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: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 52e7e816
...@@ -2139,6 +2139,11 @@ int cpufreq_update_policy(unsigned int cpu) ...@@ -2139,6 +2139,11 @@ int cpufreq_update_policy(unsigned int cpu)
*/ */
if (cpufreq_driver->get) { if (cpufreq_driver->get) {
new_policy.cur = cpufreq_driver->get(cpu); new_policy.cur = cpufreq_driver->get(cpu);
if (WARN_ON(!new_policy.cur)) {
ret = -EIO;
goto no_policy;
}
if (!policy->cur) { if (!policy->cur) {
pr_debug("Driver did not initialize current freq"); pr_debug("Driver did not initialize current freq");
policy->cur = new_policy.cur; policy->cur = new_policy.cur;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment