Skip to content

Commit cb4daa4

Browse files
emomaxdij-intel
authored andcommitted
platform/x86: hp-wmi: fix u8 underflow in gpu_delta calculation
gpu_delta was declared as u8. If the firmware specifies a GPU RPM lower than the CPU RPM, subtracting them causes an underflow (e.g. 10 - 20 = 246), which forces the GPU fan to remain clamped at U8_MAX (100% speed) during operation. Change gpu_delta to int and use signed arithmetic. Existing signed logic in hp_wmi_fan_speed_set() correctly handles negative deltas. Fixes: 46be145 ("platform/x86: hp-wmi: add manual fan control for Victus S models") Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Emre Cecanpunar <emreleno@gmail.com> Link: https://patch.msgid.link/20260407142515.20683-5-emreleno@gmail.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 6297443 commit cb4daa4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/platform/x86/hp/hp-wmi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ enum pwm_modes {
455455
struct hp_wmi_hwmon_priv {
456456
u8 min_rpm;
457457
u8 max_rpm;
458-
u8 gpu_delta;
458+
int gpu_delta;
459459
u8 mode;
460460
u8 pwm;
461461
struct delayed_work keep_alive_dwork;
@@ -2549,8 +2549,8 @@ static int hp_wmi_setup_fan_settings(struct hp_wmi_hwmon_priv *priv)
25492549
{
25502550
u8 fan_data[128] = { 0 };
25512551
struct victus_s_fan_table *fan_table;
2552-
u8 min_rpm, max_rpm, gpu_delta;
2553-
int ret;
2552+
u8 min_rpm, max_rpm;
2553+
int gpu_delta, ret;
25542554

25552555
/* Default behaviour on hwmon init is automatic mode */
25562556
priv->mode = PWM_MODE_AUTO;

0 commit comments

Comments
 (0)