[PATCH] cpufreq: conservative: Ensure requested_freq is greater than min frequency

From: Liao Chang
Date: Tue Sep 12 2023 - 02:12:21 EST


The governor ensures that the requested frequency is greater than the
minimum frequency when the condition for decreasing frequency is
satisfied. This is done by either reducing the frequency step from the
current frequency if the current frequency is greater than the sum of
the frequency step and the minimum frequency, or setting the frequency
to the minimum one otherwise.

Signed-off-by: Liao Chang <liaochang1@xxxxxxxxxx>
---
drivers/cpufreq/cpufreq_conservative.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 56500b25d77c..54e09242b2e2 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -130,7 +130,7 @@ static unsigned int cs_dbs_update(struct cpufreq_policy *policy)
if (requested_freq == policy->min)
goto out;

- if (requested_freq > freq_step)
+ if (requested_freq > policy->min + freq_step)
requested_freq -= freq_step;
else
requested_freq = policy->min;
--
2.34.1