public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: Return -EINVAL if no policy is boost supported
@ 2025-11-26  3:19 Lifeng Zheng
  2025-11-26  6:29 ` Viresh Kumar
  2025-11-28  6:10 ` Viresh Kumar
  0 siblings, 2 replies; 5+ messages in thread
From: Lifeng Zheng @ 2025-11-26  3:19 UTC (permalink / raw)
  To: rafael, viresh.kumar
  Cc: linux-pm, linux-kernel, linuxarm, jonathan.cameron, zhanjie9,
	lihuisong, yubowen8, zhangpengjie2, wangzhi12, linhongye,
	zhenglifeng1

In cpufreq_boost_trigger_state(), if all the policies are boost
unsupported, policy_set_boost() will not be called and this function will
return 0. But it is better to return an error to indicate that the platform
doesn't support boost.

Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
---
 drivers/cpufreq/cpufreq.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index e8d7544b77b8..2df714b24074 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2806,7 +2806,9 @@ static int cpufreq_boost_trigger_state(int state)
 {
 	struct cpufreq_policy *policy;
 	unsigned long flags;
-	int ret = 0;
+
+	/* Return -EINVAL if no policy is boost supported. */
+	int ret = -EINVAL;
 
 	/*
 	 * Don't compare 'cpufreq_driver->boost_enabled' with 'state' here to
@@ -2824,14 +2826,12 @@ static int cpufreq_boost_trigger_state(int state)
 
 		ret = policy_set_boost(policy, state);
 		if (ret)
-			goto err_reset_state;
+			break;
 	}
 	cpus_read_unlock();
 
-	return 0;
-
-err_reset_state:
-	cpus_read_unlock();
+	if (!ret)
+		return 0;
 
 	write_lock_irqsave(&cpufreq_driver_lock, flags);
 	cpufreq_driver->boost_enabled = !state;
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-11-28  6:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-26  3:19 [PATCH] cpufreq: Return -EINVAL if no policy is boost supported Lifeng Zheng
2025-11-26  6:29 ` Viresh Kumar
2025-11-28  4:02   ` zhenglifeng (A)
2025-11-28  6:06     ` Viresh Kumar
2025-11-28  6:10 ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox