Skip to content

Commit bd0fa9b

Browse files
vireshkrafaeljw
authored andcommitted
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>
1 parent 52e7e81 commit bd0fa9b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎drivers/cpufreq/cpufreq.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,6 +2139,11 @@ int cpufreq_update_policy(unsigned int cpu)
21392139
*/
21402140
if (cpufreq_driver->get) {
21412141
new_policy.cur = cpufreq_driver->get(cpu);
2142+
if (WARN_ON(!new_policy.cur)) {
2143+
ret = -EIO;
2144+
goto no_policy;
2145+
}
2146+
21422147
if (!policy->cur) {
21432148
pr_debug("Driver did not initialize current freq");
21442149
policy->cur = new_policy.cur;

0 commit comments

Comments
 (0)