Skip to content

Commit cea04f3

Browse files
Peng Marafaeljw
authored andcommitted
cpufreq: amd-pstate: fix memory leak on CPU EPP exit
The cpudata memory from kzalloc() in amd_pstate_epp_cpu_init() is not freed in the analogous exit function, so fix that. Signed-off-by: Peng Ma <andypma@tencent.com> Acked-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Perry Yuan <Perry.Yuan@amd.com> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 0c181b1 commit cea04f3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,13 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
14411441

14421442
static int amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy)
14431443
{
1444+
struct amd_cpudata *cpudata = policy->driver_data;
1445+
1446+
if (cpudata) {
1447+
kfree(cpudata);
1448+
policy->driver_data = NULL;
1449+
}
1450+
14441451
pr_debug("CPU %d exiting\n", policy->cpu);
14451452
return 0;
14461453
}

0 commit comments

Comments
 (0)