Skip to content

Commit 4b11f23

Browse files
Wer-Wolfij-intel
authored andcommitted
platform/x86: acer-wmi: Fix missing capability check
During the rework of the fan behavior control code in commit d8e8362 ("platform/x86: acer-wmi: Fix setting of fan behavior"), acer_toggle_turbo() was changed to use WMID_gaming_set_fan_behavior() instead of WMID_gaming_set_u64() when switching the fans to turbo mode. The new function however does not check if the necessary capability (ACER_CAP_TURBO_FAN) is actually enabled on a given machine, causing the driver to potentially access unsupported features. Fix this by manually checking if ACER_CAP_TURBO_FAN is enabled on a given machine before changing the fan mode. Cc: stable@vger.kernel.org Fixes: d8e8362 ("platform/x86: acer-wmi: Fix setting of fan behavior") Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://patch.msgid.link/20260108164716.14376-2-W_Armin@gmx.de Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 4090171 commit 4b11f23

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/platform/x86/acer-wmi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,7 +2070,8 @@ static int acer_toggle_turbo(void)
20702070
WMID_gaming_set_u64(0x1, ACER_CAP_TURBO_LED);
20712071

20722072
/* Set FAN mode to auto */
2073-
WMID_gaming_set_fan_mode(ACER_WMID_FAN_MODE_AUTO);
2073+
if (has_cap(ACER_CAP_TURBO_FAN))
2074+
WMID_gaming_set_fan_mode(ACER_WMID_FAN_MODE_AUTO);
20742075

20752076
/* Set OC to normal */
20762077
if (has_cap(ACER_CAP_TURBO_OC)) {
@@ -2084,7 +2085,8 @@ static int acer_toggle_turbo(void)
20842085
WMID_gaming_set_u64(0x10001, ACER_CAP_TURBO_LED);
20852086

20862087
/* Set FAN mode to turbo */
2087-
WMID_gaming_set_fan_mode(ACER_WMID_FAN_MODE_TURBO);
2088+
if (has_cap(ACER_CAP_TURBO_FAN))
2089+
WMID_gaming_set_fan_mode(ACER_WMID_FAN_MODE_TURBO);
20882090

20892091
/* Set OC to turbo mode */
20902092
if (has_cap(ACER_CAP_TURBO_OC)) {

0 commit comments

Comments
 (0)