lkml.org 
[lkml]   [2023]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] cpufreq: Fix policy->freq_table is NULL in __cpufreq_driver_target()
April 3, 2023 12:11 PM, "Viresh Kumar" <viresh.kumar@linaro.org> wrote:

> On 29-03-23, 21:36, Yajun Deng wrote:
>
>> __resolve_freq() may be return target_freq if policy->freq_table is
>> NULL. In this case, it should return -EINVAL before __target_index().
>>
>> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
>> ---
>> 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 c0e5be0fe2d6..308a3df1a940 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -2299,7 +2299,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
>> return cpufreq_driver->target(policy, target_freq, relation);
>> }
>>
>> - if (!cpufreq_driver->target_index)
>> + if (!cpufreq_driver->target_index || !policy->freq_table)
>> return -EINVAL;
>
> Hi,
>
> I have sent an alternate patch [1] for this, please try it.
>

Thanks, v2 is fine.

> --
> viresh
>
> [1]
> https://lore.kernel.org/all/53d4ed4e5b18a59a48790434f8146fb207e11c49.1680494945.git.viresh.kumar@lin
> ro.org

\
 
 \ /
  Last update: 2023-04-04 05:09    [W:0.058 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site