diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2012-10-24 23:39:48 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-15 00:33:07 +0100 |
commit | 0676f7f2e7d2adec11f40320ca43a8897b8ef906 (patch) | |
tree | ac9237b4557865cf921e84d94f7c063161d103b0 /drivers/cpufreq | |
parent | 8636fd280e970696be62c8495a5aacb5f3b6237d (diff) | |
download | linux-0676f7f2e7d2adec11f40320ca43a8897b8ef906.tar.gz linux-0676f7f2e7d2adec11f40320ca43a8897b8ef906.tar.bz2 linux-0676f7f2e7d2adec11f40320ca43a8897b8ef906.zip |
cpufreq: return early from __cpufreq_driver_getavg()
There is no need to do cpufreq_get_cpu() and cpufreq_put_cpu() for drivers that
don't support getavg() routine.
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')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 85df5387bc61..f552d5fe0f8f 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1511,12 +1511,14 @@ int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu) { int ret = 0; + if (!(cpu_online(cpu) && cpufreq_driver->getavg)) + return 0; + policy = cpufreq_cpu_get(policy->cpu); if (!policy) return -EINVAL; - if (cpu_online(cpu) && cpufreq_driver->getavg) - ret = cpufreq_driver->getavg(policy, cpu); + ret = cpufreq_driver->getavg(policy, cpu); cpufreq_cpu_put(policy); return ret; |