Re: [PATCH] cpufreq: cached_resolved_idx can not be negative

From: Viresh Kumar
Date: Thu Jul 30 2020 - 02:10:58 EST


On 30-07-20, 11:29, Amit Kucheria wrote:
> On Thu, Jul 30, 2020 at 9:38 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> >
> > It is not possible for cached_resolved_idx to be invalid here as the
> > cpufreq core always sets index to a positive value.
> >
> > Change its type to unsigned int and fix qcom usage a bit.
>
> Shouldn't you fix up idx in cpufreq_driver_resolve_freq() to be
> unsigned int too?

Yes, merged this into the patch.

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 0128de3603df..053d72e52a31 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -538,7 +538,7 @@ unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
policy->cached_target_freq = target_freq;

if (cpufreq_driver->target_index) {
- int idx;
+ unsigned int idx;

idx = cpufreq_frequency_table_target(policy, target_freq,
CPUFREQ_RELATION_L);

--
viresh