summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-06-03 07:28:51 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-06-09 00:58:06 +0200
commitd218ed773915a2b762d132be6bb765637338c360 (patch)
tree12e1e64d24fc80cbadff5285a439d441ed186c2f /drivers/cpufreq/cpufreq.c
parentcpufreq: Drop 'freq_table' argument of __target_index() (diff)
downloadlinux-d218ed773915a2b762d132be6bb765637338c360.tar.xz
linux-d218ed773915a2b762d132be6bb765637338c360.zip
cpufreq: Return index from cpufreq_frequency_table_target()
This routine can't fail unless the frequency table is invalid and doesn't contain any valid entries. Make it return the index and WARN() in case it is used for an invalid table. 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.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 1685e930770f..07c933c6c29a 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1914,7 +1914,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int relation)
{
unsigned int old_target_freq = target_freq;
- int index, retval;
+ int index;
if (cpufreq_disabled())
return -ENODEV;
@@ -1943,12 +1943,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
if (!cpufreq_driver->target_index)
return -EINVAL;
- retval = cpufreq_frequency_table_target(policy, target_freq, relation,
- &index);
- if (unlikely(retval)) {
- pr_err("%s: Unable to find matching freq\n", __func__);
- return retval;
- }
+ index = cpufreq_frequency_table_target(policy, target_freq, relation);
return __target_index(policy, index);
}