Skip to contentSkip to conversation

clk: ti: dra7-atl-clock: fix a memory leak

PATCH New Tero Kristo 2 participants 3 messages Sep 12, 2014 – Sep 29, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: ti: dra7-atl-clock: fix a memory leak

of_clk_add_provider makes an internal copy of the parent_names property while its called, thus it is no longer needed after this call and can be freed.

Cc Mike Turquette <[email protected]>
Cc Peter Ujfalusi <[email protected]>
---
 drivers/clk/ti/clk-dra7-atl.c |    1 +
 1 file changed, 1 insertion(+)
drivers/clk/ti/clk-dra7-atl.c +1 -0
index 4a65b41..3f9308a 100644
@@ -199,6 +199,7 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node)
 
 	if (!IS_ERR(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
+		kfree(parent_names);
 		return;
 	}
 cleanup:
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 clk: ti: dra7-atl-clock: fix a memory leak

Quoted 3 lines · Tero Kristo

of_clk_add_provider makes an internal copy of the parent_names property while its called, thus it is no longer needed after this call and can be freed.

Thanks Tero, indeed this was overlooked in the original driver.

Quoted 20 lines
Cc Mike Turquette <[email protected]>
Cc Peter Ujfalusi <[email protected]>
---
 drivers/clk/ti/clk-dra7-atl.c |    1 +
 1 file changed, 1 insertion(+)
drivers/clk/ti/clk-dra7-atl.c +1 -0
index 4a65b41..3f9308a 100644
@@ -199,6 +199,7 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node)
 
 	if (!IS_ERR(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
+		kfree(parent_names);
 		return;
 	}
 cleanup:
Signature · 1 line
P?ter
author Applied
#2 lore raw

PATCH 1/1 clk: ti: dra7-atl-clock: fix a memory leak

Quoted 8 lines · Peter Ujfalusi
Quoted 3 lines · Tero Kristo

of_clk_add_provider makes an internal copy of the parent_names property while its called, thus it is no longer needed after this call and can be freed.

Thanks Tero, indeed this was overlooked in the original driver.

Applied to for-v3.18/ti-clk-driver.

-Tero

Quoted 24 lines
Quoted 22 lines
Cc Mike Turquette <[email protected]>
Cc Peter Ujfalusi <[email protected]>
---
  drivers/clk/ti/clk-dra7-atl.c |    1 +
  1 file changed, 1 insertion(+)
drivers/clk/ti/clk-dra7-atl.c +1 -0
index 4a65b41..3f9308a 100644
@@ -199,6 +199,7 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node)
 
  	if (!IS_ERR(clk)) {
  		of_clk_add_provider(node, of_clk_src_simple_get, clk);
+		kfree(parent_names);
  		return;
  	}
  cleanup: