Skip to content

Commit 552abb8

Browse files
committed
cpufreq: Fix up cpufreq_boost_set_sw()
After commit 18c4992 ("cpufreq: Add QoS requests for userspace constraints") the return value of freq_qos_update_request(), that can be 1, passed by cpufreq_boost_set_sw() to its caller sometimes confuses the latter, which only expects to see 0 or negative error codes, so notice that cpufreq_boost_set_sw() can return an error code (which should not be -EINVAL for that matter) as soon as the first policy without a frequency table is found (because either all policies have a frequency table or none of them have it) and rework it to meet its caller's expectations. Fixes: 18c4992 ("cpufreq: Add QoS requests for userspace constraints") Reported-by: Serge Semin <[email protected]> Reported-by: Xiongfeng Wang <[email protected]> Acked-by: Viresh Kumar <[email protected]> Cc: 5.3+ <[email protected]> # 5.3+ Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 2909438 commit 552abb8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/cpufreq/cpufreq.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2535,26 +2535,27 @@ EXPORT_SYMBOL_GPL(cpufreq_update_limits);
25352535
static int cpufreq_boost_set_sw(int state)
25362536
{
25372537
struct cpufreq_policy *policy;
2538-
int ret = -EINVAL;
25392538

25402539
for_each_active_policy(policy) {
2540+
int ret;
2541+
25412542
if (!policy->freq_table)
2542-
continue;
2543+
return -ENXIO;
25432544

25442545
ret = cpufreq_frequency_table_cpuinfo(policy,
25452546
policy->freq_table);
25462547
if (ret) {
25472548
pr_err("%s: Policy frequency update failed\n",
25482549
__func__);
2549-
break;
2550+
return ret;
25502551
}
25512552

25522553
ret = freq_qos_update_request(policy->max_freq_req, policy->max);
25532554
if (ret < 0)
2554-
break;
2555+
return ret;
25552556
}
25562557

2557-
return ret;
2558+
return 0;
25582559
}
25592560

25602561
int cpufreq_boost_trigger_state(int state)

0 commit comments

Comments
 (0)