From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Viresh Kumar <viresh.kumar@linaro.org>,
Xuewen Yan <xuewen.yan@unisoc.com>
Cc: Lukasz Luba <lukasz.luba@arm.com>,
Amit Kachhap <amit.kachhap@gmail.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Amit Kucheria <amitk@kernel.org>,
"Zhang, Rui" <rui.zhang@intel.com>,
Linux PM <linux-pm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
xuewen.yan94@gmail.com, Di Shen <di.shen@unisoc.com>
Subject: Re: [PATCH] thermal: Check the policy first in cpufreq_cooling_register
Date: Sat, 3 Sep 2022 20:09:08 +0200 [thread overview]
Message-ID: <CAJZ5v0j=s-RS2oVjPtR0=pAiXHNwvtDih6Jt6dffC4eKh1bBcg@mail.gmail.com> (raw)
In-Reply-To: <20220830053417.eebsc6joyvlpti3s@vireshk-i7>
On Tue, Aug 30, 2022 at 7:34 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 25-08-22, 19:40, Xuewen Yan wrote:
> > Since the policy needs to be accessed first when obtaining cpu devices,
> > first check whether the policy is legal before this.
> >
> > Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
>
> Fixes: 5130802ddbb1 ("thermal: cpu_cooling: Switch to QoS requests for freq limits")
>
> > ---
> > drivers/thermal/cpufreq_cooling.c | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c
> > index b76293cc989c..7838b6e2dba5 100644
> > --- a/drivers/thermal/cpufreq_cooling.c
> > +++ b/drivers/thermal/cpufreq_cooling.c
> > @@ -501,17 +501,17 @@ __cpufreq_cooling_register(struct device_node *np,
> > struct thermal_cooling_device_ops *cooling_ops;
> > char *name;
> >
> > + if (IS_ERR_OR_NULL(policy)) {
> > + pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy);
> > + return ERR_PTR(-EINVAL);
> > + }
> > +
> > dev = get_cpu_device(policy->cpu);
> > if (unlikely(!dev)) {
> > pr_warn("No cpu device for cpu %d\n", policy->cpu);
> > return ERR_PTR(-ENODEV);
> > }
> >
> > - if (IS_ERR_OR_NULL(policy)) {
> > - pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy);
> > - return ERR_PTR(-EINVAL);
> > - }
> > -
> > i = cpufreq_table_count_valid_entries(policy);
> > if (!i) {
> > pr_debug("%s: CPUFreq table not found or has no valid entries\n",
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Applied as 6.1 material, thanks!
prev parent reply other threads:[~2022-09-03 18:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 11:40 [PATCH] thermal: Check the policy first in cpufreq_cooling_register Xuewen Yan
2022-08-29 6:28 ` Xuewen Yan
2022-08-30 5:34 ` Viresh Kumar
2022-09-03 18:09 ` Rafael J. Wysocki [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='CAJZ5v0j=s-RS2oVjPtR0=pAiXHNwvtDih6Jt6dffC4eKh1bBcg@mail.gmail.com' \
--to=rafael@kernel.org \
--cc=amit.kachhap@gmail.com \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=di.shen@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rui.zhang@intel.com \
--cc=viresh.kumar@linaro.org \
--cc=xuewen.yan94@gmail.com \
--cc=xuewen.yan@unisoc.com \
/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).