Skip to content

Commit 1075d43

Browse files
committed
cpufreq/amd-pstate: Fix cpufreq_policy ref counting
JIRA: https://issues.redhat.com/browse/RHEL-75923 commit 3ace200 Author: Dhananjay Ugwekar <[email protected]> Date: Wed Feb 5 11:25:20 2025 +0000 cpufreq/amd-pstate: Fix cpufreq_policy ref counting amd_pstate_update_limits() takes a cpufreq_policy reference but doesn't decrement the refcount in one of the exit paths, fix that. Fixes: 45722e7 ("cpufreq: amd-pstate: Optimize amd_pstate_update_limits()") Signed-off-by: Dhananjay Ugwekar <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: David Arcari <[email protected]>
1 parent c5b955b commit 1075d43

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -821,20 +821,21 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)
821821

822822
static void amd_pstate_update_limits(unsigned int cpu)
823823
{
824-
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
824+
struct cpufreq_policy *policy = NULL;
825825
struct amd_cpudata *cpudata;
826826
u32 prev_high = 0, cur_high = 0;
827827
int ret;
828828
bool highest_perf_changed = false;
829829

830+
if (!amd_pstate_prefcore)
831+
return;
832+
833+
policy = cpufreq_cpu_get(cpu);
830834
if (!policy)
831835
return;
832836

833837
cpudata = policy->driver_data;
834838

835-
if (!amd_pstate_prefcore)
836-
return;
837-
838839
guard(mutex)(&amd_pstate_driver_lock);
839840

840841
ret = amd_get_highest_perf(cpu, &cur_high);

0 commit comments

Comments
 (0)