cpufreq: governor: CPUFREQ_GOV_LIMITS never fails
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 13 May 2016 22:59:27 +0000 (00:59 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 30 May 2016 12:34:16 +0000 (14:34 +0200)
None of the cpufreq governors currently in the tree will ever fail
an invocation of the ->governor() callback with the event argument
equal to CPUFREQ_GOV_LIMITS (unless invoked with incorrect arguments
which doesn't matter anyway) and had it ever failed, the result of
it wouldn't have been very clean.

For this reason, rearrange the code in the core to ignore the return
value of cpufreq_governor() when called with event equal to
CPUFREQ_GOV_LIMITS.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/cpufreq.c

index 36bc11a106aa075ab2bf0d85d00f0acff2b60770..e3e666109e2144da49fada453ca8841ae794e4b0 100644 (file)
@@ -2054,7 +2054,11 @@ static int cpufreq_start_governor(struct cpufreq_policy *policy)
                cpufreq_update_current_freq(policy);
 
        ret = cpufreq_governor(policy, CPUFREQ_GOV_START);
-       return ret ? ret : cpufreq_governor(policy, CPUFREQ_GOV_LIMITS);
+       if (ret)
+               return ret;
+
+       cpufreq_governor(policy, CPUFREQ_GOV_LIMITS);
+       return 0;
 }
 
 int cpufreq_register_governor(struct cpufreq_governor *governor)
@@ -2195,7 +2199,8 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
 
        if (new_policy->governor == policy->governor) {
                pr_debug("cpufreq: governor limits update\n");
-               return cpufreq_governor(policy, CPUFREQ_GOV_LIMITS);
+               cpufreq_governor(policy, CPUFREQ_GOV_LIMITS);
+               return 0;
        }
 
        pr_debug("governor switch\n");