summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorPeng Ma <andypma@tencent.com>2024-05-16 14:30:42 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-05-16 10:38:07 +0200
commitcea04f3d9aeebda9d9c063c0dfa71e739c322c81 (patch)
tree9a594a12f296d728b2e4541bcc8133d238e20d87 /drivers/cpufreq
parent0c181b1d97dc4deaa902da46740e412c0d0bf9fb (diff)
downloadlinux-cea04f3d9aeebda9d9c063c0dfa71e739c322c81.tar.gz
linux-cea04f3d9aeebda9d9c063c0dfa71e739c322c81.tar.bz2
linux-cea04f3d9aeebda9d9c063c0dfa71e739c322c81.zip
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>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/amd-pstate.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 6a342b0c0140..1b7e82a0ad2e 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -1441,6 +1441,13 @@ free_cpudata1:
static int amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy)
{
+ struct amd_cpudata *cpudata = policy->driver_data;
+
+ if (cpudata) {
+ kfree(cpudata);
+ policy->driver_data = NULL;
+ }
+
pr_debug("CPU %d exiting\n", policy->cpu);
return 0;
}