diff options
| author | Dhananjay Ugwekar <dhananjay.ugwekar@amd.com> | 2025-02-05 11:25:20 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-02-21 14:01:40 +0100 |
| commit | 56e6976793c0fcf1638aa534242408ab4e4ca705 (patch) | |
| tree | f3985a41829f3a70b7aa405f9420bb9f7e3792a1 /drivers/cpufreq | |
| parent | 698d93debbc5b40f7c70bdb9dc355fd1bb78ada6 (diff) | |
| download | linux-56e6976793c0fcf1638aa534242408ab4e4ca705.tar.gz linux-56e6976793c0fcf1638aa534242408ab4e4ca705.tar.bz2 linux-56e6976793c0fcf1638aa534242408ab4e4ca705.zip | |
cpufreq/amd-pstate: Fix cpufreq_policy ref counting
[ Upstream commit 3ace20038e19f23fe73259513f1f08d4bf1a3c83 ]
amd_pstate_update_limits() takes a cpufreq_policy reference but doesn't
decrement the refcount in one of the exit paths, fix that.
Fixes: 45722e777fd9 ("cpufreq: amd-pstate: Optimize amd_pstate_update_limits()")
Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20250205112523.201101-10-dhananjay.ugwekar@amd.com
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/cpufreq')
| -rw-r--r-- | drivers/cpufreq/amd-pstate.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 33777f5ab7d1..bdfd8ffe0439 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -778,20 +778,21 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata) static void amd_pstate_update_limits(unsigned int cpu) { - struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); + struct cpufreq_policy *policy = NULL; struct amd_cpudata *cpudata; u32 prev_high = 0, cur_high = 0; int ret; bool highest_perf_changed = false; + if (!amd_pstate_prefcore) + return; + + policy = cpufreq_cpu_get(cpu); if (!policy) return; cpudata = policy->driver_data; - if (!amd_pstate_prefcore) - return; - guard(mutex)(&amd_pstate_driver_lock); ret = amd_get_highest_perf(cpu, &cur_high); |
