[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250814085216.358207-1-zhangzihuan@kylinos.cn>
Date: Thu, 14 Aug 2025 16:52:16 +0800
From: Zihuan Zhang <zhangzihuan@...inos.cn>
To: "rafael J . wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>
Cc: zhenglifeng <zhenglifeng1@...wei.com>,
linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Zihuan Zhang <zhangzihuan@...inos.cn>
Subject: [PATCH v1] cpufreq: Return current frequency when frequency table is unavailable
In cases where the CPU frequency table (freq_table) is not available,
the __resolve_freq() function will now return the current frequency
(policy->cur) instead of the requested target frequency. This ensures
that the system doesn't return an invalid or uninitialized frequency
value when frequency scaling is not supported or not initialized.
This change improves the stability of the frequency scaling logic when
the CPU frequency table is not populated, preventing errors related
to unavailable frequency tables.
Signed-off-by: Zihuan Zhang <zhangzihuan@...inos.cn>
---
drivers/cpufreq/cpufreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index fc7eace8b65b..ca9b7807a288 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -502,7 +502,7 @@ static unsigned int __resolve_freq(struct cpufreq_policy *policy,
target_freq = clamp_val(target_freq, min, max);
if (!policy->freq_table)
- return target_freq;
+ return policy->cur;
idx = cpufreq_frequency_table_target(policy, target_freq, min, max, relation);
policy->cached_resolved_idx = idx;
--
2.25.1
Powered by blists - more mailing lists