* [PATCH] platform/x86: hp-wmi: handle positive BIOS error codes
@ 2026-06-30 10:52 Yousef Alhouseen
2026-07-21 17:28 ` Ilpo Järvinen
0 siblings, 1 reply; 3+ messages in thread
From: Yousef Alhouseen @ 2026-06-30 10:52 UTC (permalink / raw)
To: Hans de Goede, Ilpo Järvinen
Cc: Krishna Chomal, Rafael J . Wysocki, platform-driver-x86,
linux-kernel, Yousef Alhouseen
hp_wmi_perform_query() returns firmware BIOS error codes as positive
values. The Victus-S profile callers only reject negative errors, then
consume output fields that are not filled for a positive firmware error.
Treat every nonzero result from victus_s_gpu_thermal_profile_get()
as a failed query before using its outputs.
Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
---
drivers/platform/x86/hp/hp-wmi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
index 8ba286ed8721..50c5a1e152dd 100644
--- a/drivers/platform/x86/hp/hp-wmi.c
+++ b/drivers/platform/x86/hp/hp-wmi.c
@@ -1825,7 +1825,7 @@ static int victus_s_gpu_thermal_profile_set(bool ctgp_enable,
¤t_ppab_state,
¤t_dstate,
¤t_gpu_slowdown_temp);
- if (ret < 0) {
+ if (ret) {
pr_warn("GPU modes not updated, unable to get slowdown temp\n");
return ret;
}
@@ -1907,7 +1907,7 @@ static int platform_profile_victus_s_get_ec(enum platform_profile_option *profil
¤t_ppab_state,
¤t_dstate,
¤t_gpu_slowdown_temp);
- if (ret < 0)
+ if (ret)
return ret;
if (current_ctgp_state == 0 && current_ppab_state == 0)
*profile = PLATFORM_PROFILE_LOW_POWER;
--
2.54.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: hp-wmi: handle positive BIOS error codes
2026-06-30 10:52 [PATCH] platform/x86: hp-wmi: handle positive BIOS error codes Yousef Alhouseen
@ 2026-07-21 17:28 ` Ilpo Järvinen
2026-07-30 22:08 ` Yousef Alhouseen
0 siblings, 1 reply; 3+ messages in thread
From: Ilpo Järvinen @ 2026-07-21 17:28 UTC (permalink / raw)
To: Yousef Alhouseen
Cc: Hans de Goede, Krishna Chomal, Rafael J . Wysocki,
platform-driver-x86, LKML
On Tue, 30 Jun 2026, Yousef Alhouseen wrote:
> hp_wmi_perform_query() returns firmware BIOS error codes as positive
> values. The Victus-S profile callers only reject negative errors, then
> consume output fields that are not filled for a positive firmware error.
On which hw you see this? Please add the info.
> Treat every nonzero result from victus_s_gpu_thermal_profile_get()
> as a failed query before using its outputs.
>
> Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
> ---
> drivers/platform/x86/hp/hp-wmi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
> index 8ba286ed8721..50c5a1e152dd 100644
> --- a/drivers/platform/x86/hp/hp-wmi.c
> +++ b/drivers/platform/x86/hp/hp-wmi.c
> @@ -1825,7 +1825,7 @@ static int victus_s_gpu_thermal_profile_set(bool ctgp_enable,
> ¤t_ppab_state,
> ¤t_dstate,
> ¤t_gpu_slowdown_temp);
> - if (ret < 0) {
> + if (ret) {
> pr_warn("GPU modes not updated, unable to get slowdown temp\n");
> return ret;
> }
> @@ -1907,7 +1907,7 @@ static int platform_profile_victus_s_get_ec(enum platform_profile_option *profil
> ¤t_ppab_state,
> ¤t_dstate,
> ¤t_gpu_slowdown_temp);
> - if (ret < 0)
> + if (ret)
> return ret;
> if (current_ctgp_state == 0 && current_ppab_state == 0)
> *profile = PLATFORM_PROFILE_LOW_POWER;
>
--
i.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: hp-wmi: handle positive BIOS error codes
2026-07-21 17:28 ` Ilpo Järvinen
@ 2026-07-30 22:08 ` Yousef Alhouseen
0 siblings, 0 replies; 3+ messages in thread
From: Yousef Alhouseen @ 2026-07-30 22:08 UTC (permalink / raw)
To: ilpo.jarvinen
Cc: hansg, krishna.chomal108, rafael.j.wysocki, platform-driver-x86,
linux-kernel
Hi Ilpo,
No specific hardware exhibited this; I found it by static inspection.
hp_wmi_perform_query() documents positive BIOS error returns, while
victus_s_gpu_thermal_profile_get() only initializes its output
arguments when the return is zero, so these two ret < 0 checks can
consume uninitialized values on a positive return.
I only ran strict checkpatch and a focused Clang build of hp-wmi.o. I
do not have a Victus S system to reproduce it. If hardware validation
is required for this change, I am happy to withdraw it.
Regards,
Yousef
On Tue, 21 Jul 2026 20:28:38 +0300 (EEST), "Ilpo Järvinen"
<ilpo.jarvinen@linux.intel.com> wrote:
> On Tue, 30 Jun 2026, Yousef Alhouseen wrote:
>
> > hp_wmi_perform_query() returns firmware BIOS error codes as positive
> > values. The Victus-S profile callers only reject negative errors, then
> > consume output fields that are not filled for a positive firmware error.
>
> On which hw you see this? Please add the info.
>
> > Treat every nonzero result from victus_s_gpu_thermal_profile_get()
> > as a failed query before using its outputs.
> >
> > Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
> > ---
> > drivers/platform/x86/hp/hp-wmi.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
> > index 8ba286ed8721..50c5a1e152dd 100644
> > --- a/drivers/platform/x86/hp/hp-wmi.c
> > +++ b/drivers/platform/x86/hp/hp-wmi.c
> > @@ -1825,7 +1825,7 @@ static int victus_s_gpu_thermal_profile_set(bool ctgp_enable,
> > ¤t_ppab_state,
> > ¤t_dstate,
> > ¤t_gpu_slowdown_temp);
> > - if (ret < 0) {
> > + if (ret) {
> > pr_warn("GPU modes not updated, unable to get slowdown temp\n");
> > return ret;
> > }
> > @@ -1907,7 +1907,7 @@ static int platform_profile_victus_s_get_ec(enum platform_profile_option *profil
> > ¤t_ppab_state,
> > ¤t_dstate,
> > ¤t_gpu_slowdown_temp);
> > - if (ret < 0)
> > + if (ret)
> > return ret;
> > if (current_ctgp_state == 0 && current_ppab_state == 0)
> > *profile = PLATFORM_PROFILE_LOW_POWER;
> >
>
> --
> i.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-30 22:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-30 10:52 [PATCH] platform/x86: hp-wmi: handle positive BIOS error codes Yousef Alhouseen
2026-07-21 17:28 ` Ilpo Järvinen
2026-07-30 22:08 ` Yousef Alhouseen
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®