linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yajun Deng" <yajun.deng@linux.dev>
To: "Viresh Kumar" <viresh.kumar@linaro.org>
Cc: rafael@kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cpufreq: Fix policy->freq_table is NULL in __cpufreq_driver_target()
Date: Tue, 04 Apr 2023 03:08:30 +0000	[thread overview]
Message-ID: <fa40602f182b028ec44c976a30a66ae6@linux.dev> (raw)
In-Reply-To: <20230403041128.jrsvbm4ddxdyhddg@vireshk-i7>

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

      reply	other threads:[~2023-04-04  3:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 13:36 [PATCH] cpufreq: Fix policy->freq_table is NULL in __cpufreq_driver_target() Yajun Deng
2023-03-29 14:21 ` Rafael J. Wysocki
2023-03-30  1:39   ` Yajun Deng
2023-03-30  3:57     ` Viresh Kumar
2023-03-30 10:10       ` Rafael J. Wysocki
2023-04-03  4:11 ` Viresh Kumar
2023-04-04  3:08   ` Yajun Deng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fa40602f182b028ec44c976a30a66ae6@linux.dev \
    --to=yajun.deng@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).