diff options
| author | Lifeng Zheng <zhenglifeng1@huawei.com> | 2025-07-09 18:41:45 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-08-28 16:28:16 +0200 |
| commit | 6a8b0c7e93dfe6f343578ec7e51ee61c5e6bcc21 (patch) | |
| tree | 0485b3093fbde8d7d35f191726506961242cda03 /drivers/cpufreq | |
| parent | 20bbe54f454f7bb12f24e594d65af597ca09e901 (diff) | |
| download | linux-6a8b0c7e93dfe6f343578ec7e51ee61c5e6bcc21.tar.gz linux-6a8b0c7e93dfe6f343578ec7e51ee61c5e6bcc21.tar.bz2 linux-6a8b0c7e93dfe6f343578ec7e51ee61c5e6bcc21.zip | |
cpufreq: Exit governor when failed to start old governor
[ Upstream commit 0ae204405095abfbc2d694ee0fbb49bcbbe55c57 ]
Detect the result of starting old governor in cpufreq_set_policy(). If it
fails, exit the governor and clear policy->governor.
Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
Link: https://patch.msgid.link/20250709104145.2348017-5-zhenglifeng1@huawei.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/cpufreq')
| -rw-r--r-- | drivers/cpufreq/cpufreq.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index cc98d8cf5433..6ee1767ba08f 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2701,10 +2701,12 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, pr_debug("starting governor %s failed\n", policy->governor->name); if (old_gov) { policy->governor = old_gov; - if (cpufreq_init_governor(policy)) + if (cpufreq_init_governor(policy)) { policy->governor = NULL; - else - cpufreq_start_governor(policy); + } else if (cpufreq_start_governor(policy)) { + cpufreq_exit_governor(policy); + policy->governor = NULL; + } } return ret; |
