Skip to content

Commit

Permalink
cpufreq: Throw warning when we try to get policy for an invalid CPU
Browse files Browse the repository at this point in the history
Simply returning here with an error is not enough. It shouldn't be allowed at
all to try calling cpufreq_cpu_get() for an invalid CPU.

Add a WARN here to make it clear that it wouldn't be acceptable at all.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Viresh Kumar authored and Rafael J. Wysocki committed May 7, 2015
1 parent 23faf0b commit 1b947c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
struct cpufreq_policy *policy = NULL;
unsigned long flags;

if (cpu >= nr_cpu_ids)
if (WARN_ON(cpu >= nr_cpu_ids))
return NULL;

if (!down_read_trylock(&cpufreq_rwsem))
Expand Down

0 comments on commit 1b947c9

Please sign in to comment.