public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: mvebu/clk-cpu.c: fix memory leakage
@ 2013-01-14 17:18 Cong Ding
  2013-01-15 14:13 ` Gregory CLEMENT
  0 siblings, 1 reply; 14+ messages in thread
From: Cong Ding @ 2013-01-14 17:18 UTC (permalink / raw)
  To: Gregory CLEMENT, Thomas Petazzoni, linux-kernel; +Cc: Cong Ding

the variable cpuclk and clk_name should be properly freed.

Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
 drivers/clk/mvebu/clk-cpu.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/mvebu/clk-cpu.c b/drivers/clk/mvebu/clk-cpu.c
index ff004578..1a0d84f 100644
--- a/drivers/clk/mvebu/clk-cpu.c
+++ b/drivers/clk/mvebu/clk-cpu.c
@@ -124,7 +124,7 @@ void __init of_cpu_clk_setup(struct device_node *node)
 
 	clks = kzalloc(ncpus * sizeof(*clks), GFP_KERNEL);
 	if (WARN_ON(!clks))
-		return;
+		goto clks_out;
 
 	for_each_node_by_type(dn, "cpu") {
 		struct clk_init_data init;
@@ -134,11 +134,11 @@ void __init of_cpu_clk_setup(struct device_node *node)
 		int cpu, err;
 
 		if (WARN_ON(!clk_name))
-			return;
+			goto clk_name_out;
 
 		err = of_property_read_u32(dn, "reg", &cpu);
 		if (WARN_ON(err))
-			return;
+			goto bail_out;
 
 		sprintf(clk_name, "cpu%d", cpu);
 		parent_clk = of_clk_get(node, 0);
@@ -166,7 +166,10 @@ void __init of_cpu_clk_setup(struct device_node *node)
 
 	return;
 bail_out:
+	kfree(clk_name);
+clk_name_out:
 	kfree(clks);
+clks_out:
 	kfree(cpuclk);
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-01-23  1:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 17:18 [PATCH] clk: mvebu/clk-cpu.c: fix memory leakage Cong Ding
2013-01-15 14:13 ` Gregory CLEMENT
2013-01-15 14:41   ` Cong Ding
2013-01-15 15:23   ` [PATCH v2] " Cong Ding
2013-01-15 15:37     ` Jason Cooper
2013-01-15 16:33       ` Gregory CLEMENT
2013-01-15 18:26         ` Cong Ding
2013-01-15 18:36           ` Gregory CLEMENT
2013-01-15 18:44             ` [PATCH v3] " Cong Ding
2013-01-15 20:46               ` Gregory CLEMENT
2013-01-15 20:57                 ` Jason Cooper
2013-01-16  1:01                 ` Mike Turquette
2013-01-16  2:00                   ` Jason Cooper
2013-01-23  1:08               ` Jason Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox