[PATCH 5/5] platform/x86: hp-wmi: report fan speed command failures

From: Emre Cecanpunar

Date: Thu Jul 16 2026 - 05:57:11 EST


hp_wmi_fan_speed_set() passes the raw WMI result to
hp_wmi_apply_fan_settings(), which only checks for negative errors. A
positive HP firmware error consequently reaches the success path and
schedules keep-alive work for a fan speed that was not applied.

Convert positive firmware errors to -EINVAL before returning from the fan
speed helper, matching the other fan control commands.

Fixes: c203c59fb5de ("platform/x86: hp-wmi: implement fan keep-alive")
Signed-off-by: Emre Cecanpunar <emreleno@xxxxxxxxx>
---
drivers/platform/x86/hp/hp-wmi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c
index 65c3bac17ad6..8f8da31bd5ef 100644
--- a/drivers/platform/x86/hp/hp-wmi.c
+++ b/drivers/platform/x86/hp/hp-wmi.c
@@ -907,8 +907,10 @@ static int hp_wmi_fan_speed_set(struct hp_wmi_hwmon_priv *priv)
return ret;
ret = hp_wmi_perform_query(HPWMI_VICTUS_S_FAN_SPEED_SET_QUERY, HPWMI_GM,
&fan_speed, sizeof(fan_speed), 0);
+ if (ret)
+ return ret < 0 ? ret : -EINVAL;

- return ret;
+ return 0;
}

static int hp_wmi_fan_speed_reset(struct hp_wmi_hwmon_priv *priv)