* [PATCH] powercap: dtpm_cpu: Fix error check against freq_qos_add_request()
@ 2024-02-13 22:39 Daniel Lezcano
2024-02-16 19:06 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Lezcano @ 2024-02-13 22:39 UTC (permalink / raw)
To: rafael; +Cc: linux-pm, linux-kernel, Daniel Lezcano
The caller of the function freq_qos_add_request() checks again a non
zero value but freq_qos_add_request() can return '1' if the request
already exists. Therefore, the setup function fails while the QoS
request actually did not failed.
Fix that by changing the check against a negative value like all the
other callers of the function.
Fixes: 0e8f68d7f0485 ("Add CPU energy model based support")
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/powercap/dtpm_cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c
index 9193c3b8edeb..ae7ee611978b 100644
--- a/drivers/powercap/dtpm_cpu.c
+++ b/drivers/powercap/dtpm_cpu.c
@@ -219,7 +219,7 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent)
ret = freq_qos_add_request(&policy->constraints,
&dtpm_cpu->qos_req, FREQ_QOS_MAX,
pd->table[pd->nr_perf_states - 1].frequency);
- if (ret)
+ if (ret < 0)
goto out_dtpm_unregister;
cpufreq_cpu_put(policy);
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] powercap: dtpm_cpu: Fix error check against freq_qos_add_request()
2024-02-13 22:39 [PATCH] powercap: dtpm_cpu: Fix error check against freq_qos_add_request() Daniel Lezcano
@ 2024-02-16 19:06 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2024-02-16 19:06 UTC (permalink / raw)
To: Daniel Lezcano; +Cc: rafael, linux-pm, linux-kernel, Daniel Lezcano
On Tue, Feb 13, 2024 at 11:39 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> The caller of the function freq_qos_add_request() checks again a non
> zero value but freq_qos_add_request() can return '1' if the request
> already exists. Therefore, the setup function fails while the QoS
> request actually did not failed.
>
> Fix that by changing the check against a negative value like all the
> other callers of the function.
>
> Fixes: 0e8f68d7f0485 ("Add CPU energy model based support")
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> drivers/powercap/dtpm_cpu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c
> index 9193c3b8edeb..ae7ee611978b 100644
> --- a/drivers/powercap/dtpm_cpu.c
> +++ b/drivers/powercap/dtpm_cpu.c
> @@ -219,7 +219,7 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent)
> ret = freq_qos_add_request(&policy->constraints,
> &dtpm_cpu->qos_req, FREQ_QOS_MAX,
> pd->table[pd->nr_perf_states - 1].frequency);
> - if (ret)
> + if (ret < 0)
> goto out_dtpm_unregister;
>
> cpufreq_cpu_put(policy);
> --
Applied as 6.9 material, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-16 19:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 22:39 [PATCH] powercap: dtpm_cpu: Fix error check against freq_qos_add_request() Daniel Lezcano
2024-02-16 19:06 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®