linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] delete unneeded of_node_put
@ 2015-10-09 17:47 Julia Lawall
  2015-10-09 17:47 ` [PATCH 2/2] clk: tegra: " Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2015-10-09 17:47 UTC (permalink / raw)
  To: Stephen Warren
  Cc: kernel-janitors, Thierry Reding, Alexandre Courbot, linux-tegra,
	linux-kernel, linux-clk, Russell King - ARM Linux,
	Thomas Petazzoni, Andrew Lunn, Bjorn Helgaas, Jason Cooper

for_each_child_of_node performs an of_node_put on each iteration, so
putting an of_node_put before a continue results in a double put.

---

 var/julia/linuxcopy/drivers/clk/tegra/clk-emc.c         |    4 +---
 var/julia/linuxcopy/drivers/memory/tegra/mc.c           |    4 +---
 var/julia/linuxcopy/drivers/memory/tegra/tegra124-emc.c |    4 +---
 3 files changed, 3 insertions(+), 9 deletions(-)

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

* [PATCH 2/2] clk: tegra: delete unneeded of_node_put
  2015-10-09 17:47 [PATCH 0/2] delete unneeded of_node_put Julia Lawall
@ 2015-10-09 17:47 ` Julia Lawall
  2015-10-12 18:52   ` Stephen Boyd
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2015-10-09 17:47 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: kernel-janitors, Prashant Gaikwad, Michael Turquette,
	Stephen Boyd, Stephen Warren, Thierry Reding, Alexandre Courbot,
	linux-clk, linux-tegra, linux-kernel, Russell King - ARM Linux,
	Thomas Petazzoni, Andrew Lunn, Bjorn Helgaas, Jason Cooper

for_each_child_of_node performs an of_node_put on each iteration, so
putting an of_node_put before a continue results in a double put.

The semantic match that finds this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
iterator name for_each_child_of_node;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_get(child)
*  of_node_put(child);
   ...
*  continue;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/clk/tegra/clk-emc.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/clk/tegra/clk-emc.c b/drivers/clk/tegra/clk-emc.c
index 138a94b..e1fe8f3 100644
--- a/drivers/clk/tegra/clk-emc.c
+++ b/drivers/clk/tegra/clk-emc.c
@@ -491,10 +491,8 @@ struct clk *tegra_clk_register_emc(void __iomem *base, struct device_node *np,
 	for_each_child_of_node(np, node) {
 		err = of_property_read_u32(node, "nvidia,ram-code",
 					   &node_ram_code);
-		if (err) {
-			of_node_put(node);
+		if (err)
 			continue;
-		}
 
 		/*
 		 * Store timings for all ram codes as we cannot read the

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

* Re: [PATCH 2/2] clk: tegra: delete unneeded of_node_put
  2015-10-09 17:47 ` [PATCH 2/2] clk: tegra: " Julia Lawall
@ 2015-10-12 18:52   ` Stephen Boyd
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2015-10-12 18:52 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Peter De Schrijver, kernel-janitors, Prashant Gaikwad,
	Michael Turquette, Stephen Warren, Thierry Reding,
	Alexandre Courbot, linux-clk, linux-tegra, linux-kernel,
	Russell King - ARM Linux, Thomas Petazzoni, Andrew Lunn,
	Bjorn Helgaas, Jason Cooper

On 10/09, Julia Lawall wrote:
> for_each_child_of_node performs an of_node_put on each iteration, so
> putting an of_node_put before a continue results in a double put.
> 
> The semantic match that finds this problem is as follows
> (http://coccinelle.lip6.fr):
> 
> // <smpl>
> @@
> expression root,e;
> local idexpression child;
> iterator name for_each_child_of_node;
> @@
> 
>  for_each_child_of_node(root, child) {
>    ... when != of_node_get(child)
> *  of_node_put(child);
>    ...
> *  continue;
> }
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2015-10-12 18:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-09 17:47 [PATCH 0/2] delete unneeded of_node_put Julia Lawall
2015-10-09 17:47 ` [PATCH 2/2] clk: tegra: " Julia Lawall
2015-10-12 18:52   ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).