Unverified Commit 4b11f233 authored by Armin Wolf's avatar Armin Wolf Committed by Ilpo Järvinen
Browse files

platform/x86: acer-wmi: Fix missing capability check



During the rework of the fan behavior control code in commit
d8e8362b ("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: d8e8362b ("platform/x86: acer-wmi: Fix setting of fan behavior")
Signed-off-by: default avatarArmin Wolf <W_Armin@gmx.de>
Link: https://patch.msgid.link/20260108164716.14376-2-W_Armin@gmx.de


Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
parent 40901719
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2070,6 +2070,7 @@ static int acer_toggle_turbo(void)
		WMID_gaming_set_u64(0x1, ACER_CAP_TURBO_LED);

		/* Set FAN mode to auto */
		if (has_cap(ACER_CAP_TURBO_FAN))
			WMID_gaming_set_fan_mode(ACER_WMID_FAN_MODE_AUTO);

		/* Set OC to normal */
@@ -2084,6 +2085,7 @@ static int acer_toggle_turbo(void)
		WMID_gaming_set_u64(0x10001, ACER_CAP_TURBO_LED);

		/* Set FAN mode to turbo */
		if (has_cap(ACER_CAP_TURBO_FAN))
			WMID_gaming_set_fan_mode(ACER_WMID_FAN_MODE_TURBO);

		/* Set OC to turbo mode */