* [PATCH] thermal: Check the policy first in cpufreq_cooling_register
@ 2022-08-25 11:40 Xuewen Yan
2022-08-29 6:28 ` Xuewen Yan
2022-08-30 5:34 ` Viresh Kumar
0 siblings, 2 replies; 4+ messages in thread
From: Xuewen Yan @ 2022-08-25 11:40 UTC (permalink / raw)
To: viresh.kumar, lukasz.luba, amit.kachhap, daniel.lezcano, rafael
Cc: amitk, rui.zhang, linux-pm, linux-kernel, xuewen.yan94, di.shen
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>
---
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",
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] thermal: Check the policy first in cpufreq_cooling_register
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
1 sibling, 0 replies; 4+ messages in thread
From: Xuewen Yan @ 2022-08-29 6:28 UTC (permalink / raw)
To: Xuewen Yan
Cc: viresh.kumar, lukasz.luba, amit.kachhap, daniel.lezcano, rafael,
amitk, rui.zhang, linux-pm, linux-kernel, di.shen
Hi all,
Any comments?
On Thu, Aug 25, 2022 at 7:42 PM Xuewen Yan <xuewen.yan@unisoc.com> 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>
> ---
> 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",
> --
> 2.25.1
>
THanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] thermal: Check the policy first in cpufreq_cooling_register
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
1 sibling, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2022-08-30 5:34 UTC (permalink / raw)
To: Xuewen Yan
Cc: lukasz.luba, amit.kachhap, daniel.lezcano, rafael, amitk,
rui.zhang, linux-pm, linux-kernel, xuewen.yan94, di.shen
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>
--
viresh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] thermal: Check the policy first in cpufreq_cooling_register
2022-08-30 5:34 ` Viresh Kumar
@ 2022-09-03 18:09 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2022-09-03 18:09 UTC (permalink / raw)
To: Viresh Kumar, Xuewen Yan
Cc: Lukasz Luba, Amit Kachhap, Daniel Lezcano, Rafael J. Wysocki,
Amit Kucheria, Zhang, Rui, Linux PM, Linux Kernel Mailing List,
xuewen.yan94, Di Shen
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!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-03 18:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.