Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: hp-wmi: fix ignored return values in fan settings

hp_wmi_get_fan_count_userdefine_trigger() can fail, but its return
value was silently ignored in hp_wmi_apply_fan_settings() for
PWM_MODE_MAX/AUTO. Propagate these errors consistently.

Additionally, handle the return value of hp_wmi_apply_fan_settings()
in its callers by adding appropriate warnings on failure, and remove an
unreachable "return 0" at the end of the function.

Fixes: 46be1453e6e6 ("platform/x86: hp-wmi: add manual fan control for Victus S models")
Signed-off-by: Emre Cecanpunar <emreleno@gmail.com>
Link: https://patch.msgid.link/20260407142515.20683-2-emreleno@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Emre Cecanpunar and committed by
Ilpo Järvinen
7265b57f ec427398

+16 -7
+16 -7
drivers/platform/x86/hp/hp-wmi.c
··· 2353 2353 2354 2354 switch (priv->mode) { 2355 2355 case PWM_MODE_MAX: 2356 - if (is_victus_s_thermal_profile()) 2357 - hp_wmi_get_fan_count_userdefine_trigger(); 2356 + if (is_victus_s_thermal_profile()) { 2357 + ret = hp_wmi_get_fan_count_userdefine_trigger(); 2358 + if (ret < 0) 2359 + return ret; 2360 + } 2358 2361 ret = hp_wmi_fan_speed_max_set(1); 2359 2362 if (ret < 0) 2360 2363 return ret; ··· 2375 2372 return 0; 2376 2373 case PWM_MODE_AUTO: 2377 2374 if (is_victus_s_thermal_profile()) { 2378 - hp_wmi_get_fan_count_userdefine_trigger(); 2375 + ret = hp_wmi_get_fan_count_userdefine_trigger(); 2376 + if (ret < 0) 2377 + return ret; 2379 2378 ret = hp_wmi_fan_speed_max_reset(priv); 2380 2379 } else { 2381 2380 ret = hp_wmi_fan_speed_max_set(0); ··· 2390 2385 /* shouldn't happen */ 2391 2386 return -EINVAL; 2392 2387 } 2393 - 2394 - return 0; 2395 2388 } 2396 2389 2397 2390 static umode_t hp_wmi_hwmon_is_visible(const void *data, ··· 2531 2528 { 2532 2529 struct delayed_work *dwork; 2533 2530 struct hp_wmi_hwmon_priv *priv; 2531 + int ret; 2534 2532 2535 2533 dwork = to_delayed_work(work); 2536 2534 priv = container_of(dwork, struct hp_wmi_hwmon_priv, keep_alive_dwork); ··· 2539 2535 * Re-apply the current hwmon context settings. 2540 2536 * NOTE: hp_wmi_apply_fan_settings will handle the re-scheduling. 2541 2537 */ 2542 - hp_wmi_apply_fan_settings(priv); 2538 + ret = hp_wmi_apply_fan_settings(priv); 2539 + if (ret) 2540 + pr_warn_ratelimited("keep-alive failed to refresh fan settings: %d\n", 2541 + ret); 2543 2542 } 2544 2543 2545 2544 static int hp_wmi_setup_fan_settings(struct hp_wmi_hwmon_priv *priv) ··· 2604 2597 2605 2598 INIT_DELAYED_WORK(&priv->keep_alive_dwork, hp_wmi_hwmon_keep_alive_handler); 2606 2599 platform_set_drvdata(hp_wmi_platform_dev, priv); 2607 - hp_wmi_apply_fan_settings(priv); 2600 + ret = hp_wmi_apply_fan_settings(priv); 2601 + if (ret) 2602 + dev_warn(dev, "Failed to apply initial fan settings: %d\n", ret); 2608 2603 2609 2604 return 0; 2610 2605 }