[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1603113151-5219-1-git-send-email-bodefang@126.com>
Date: Mon, 19 Oct 2020 21:12:31 +0800
From: Defang Bo <bodefang@....com>
To: rjw@...ysocki.net, viresh.kumar@...aro.org
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
Defang Bo <bodefang@....com>
Subject: [PATCH] cpufreq: ti-cpufreq: fix memory leak in ti_cpufreq_probe()
Similar to commit<05829d9431df>("cpufreq: ti-cpufreq: kfree opp_data when failure"), opp_data needs to be freed when failure, including fail_put_node.
Signed-off-by: Defang Bo <bodefang@....com>
---
drivers/cpufreq/ti-cpufreq.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c
index ab0de27..f23be8f 100644
--- a/drivers/cpufreq/ti-cpufreq.c
+++ b/drivers/cpufreq/ti-cpufreq.c
@@ -342,7 +342,8 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
opp_data->cpu_dev = get_cpu_device(0);
if (!opp_data->cpu_dev) {
pr_err("%s: Failed to get device for CPU0\n", __func__);
- return -ENODEV;
+ ret = ENODEV;
+ goto free_opp_data;
}
opp_data->opp_node = dev_pm_opp_of_get_opp_desc_node(opp_data->cpu_dev);
@@ -404,7 +405,8 @@ static int ti_cpufreq_probe(struct platform_device *pdev)
fail_put_node:
of_node_put(opp_data->opp_node);
-
+free_opp_data:
+ kfree(opp_data)
return ret;
}
--
1.9.1
Powered by blists - more mailing lists