5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christian Loehle [ Upstream commit a0cde2b601bc32b76d61e50141c619790e5e2e41 ] cpufreq_boost_trigger_state() restores the opposite of the requested state when updating policy boost state fails. For example, a failed write of 0 when global boost is already disabled enables the global flag without enabling any policies. Save the original global boost state and restore it on failure. Fixes: 121baab7b88e ("cpufreq: Force sync policy boost with global boost on sysfs update") Signed-off-by: Christian Loehle Reviewed-by: Pengjie Zhang Reviewed-by: Zhongqiu Han Reviewed-by: Sumit Gupta Link: https://patch.msgid.link/20261105215223.1263415-2-christian.loehle@arm.com Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpufreq/cpufreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 10bec33a1d36b..0a32d1e5ef687 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2701,6 +2701,7 @@ int cpufreq_boost_trigger_state(int state) { struct cpufreq_policy *policy; unsigned long flags; + bool boost_enabled; int ret = -EOPNOTSUPP; /* @@ -2709,6 +2710,7 @@ int cpufreq_boost_trigger_state(int state) */ write_lock_irqsave(&cpufreq_driver_lock, flags); + boost_enabled = cpufreq_driver->boost_enabled; cpufreq_driver->boost_enabled = state; write_unlock_irqrestore(&cpufreq_driver_lock, flags); @@ -2730,7 +2732,7 @@ int cpufreq_boost_trigger_state(int state) cpus_read_unlock(); write_lock_irqsave(&cpufreq_driver_lock, flags); - cpufreq_driver->boost_enabled = !state; + cpufreq_driver->boost_enabled = boost_enabled; write_unlock_irqrestore(&cpufreq_driver_lock, flags); pr_err("%s: Cannot %s BOOST\n", -- 2.53.0