[PATCH] cpufreq: Return -EINVAL if no policy is boost supported

From: Lifeng Zheng

Date: Tue Nov 25 2025 - 22:19:41 EST


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@xxxxxxxxxx>
---
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