* [PATCH 0/2] delete unneeded of_node_put @ 2015-10-09 17:47 Julia Lawall 2015-10-09 17:47 ` [PATCH 1/2] memory: tegra: " Julia Lawall 2015-10-09 17:47 ` [PATCH 2/2] clk: " Julia Lawall 0 siblings, 2 replies; 5+ 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] 5+ messages in thread
* [PATCH 1/2] memory: 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 2016-06-14 9:38 ` Thierry Reding 2015-10-09 17:47 ` [PATCH 2/2] clk: " Julia Lawall 1 sibling, 1 reply; 5+ 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, 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/memory/tegra/mc.c | 4 +--- drivers/memory/tegra/tegra124-emc.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c index 3dac7be..509c8ff 100644 --- a/drivers/memory/tegra/tegra124-emc.c +++ b/drivers/memory/tegra/tegra124-emc.c @@ -995,10 +995,8 @@ tegra_emc_find_node_by_ram_code(struct device_node *node, u32 ram_code) u32 value; err = of_property_read_u32(np, "nvidia,ram-code", &value); - if (err || (value != ram_code)) { - of_node_put(np); + if (err || (value != ram_code)) continue; - } return np; } diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c index a1ae0cc..85ce4be 100644 --- a/drivers/memory/tegra/mc.c +++ b/drivers/memory/tegra/mc.c @@ -206,10 +206,8 @@ static int tegra_mc_setup_timings(struct tegra_mc *mc) for_each_child_of_node(mc->dev->of_node, node) { err = of_property_read_u32(node, "nvidia,ram-code", &node_ram_code); - if (err || (node_ram_code != ram_code)) { - of_node_put(node); + if (err || (node_ram_code != ram_code)) continue; - } err = load_timings(mc, node); if (err) ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] memory: tegra: delete unneeded of_node_put 2015-10-09 17:47 ` [PATCH 1/2] memory: tegra: " Julia Lawall @ 2016-06-14 9:38 ` Thierry Reding 0 siblings, 0 replies; 5+ messages in thread From: Thierry Reding @ 2016-06-14 9:38 UTC (permalink / raw) To: Julia Lawall Cc: Stephen Warren, kernel-janitors, Alexandre Courbot, linux-tegra, linux-kernel, Russell King - ARM Linux, Thomas Petazzoni, Andrew Lunn, Bjorn Helgaas, Jason Cooper [-- Attachment #1: Type: text/plain, Size: 832 bytes --] On Fri, Oct 09, 2015 at 07:47:40PM +0200, 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> > > --- > drivers/memory/tegra/mc.c | 4 +--- > drivers/memory/tegra/tegra124-emc.c | 4 +--- > 2 files changed, 2 insertions(+), 6 deletions(-) Applied, thanks. Thierry [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 5+ 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 ` [PATCH 1/2] memory: tegra: " Julia Lawall @ 2015-10-09 17:47 ` Julia Lawall 2015-10-12 18:52 ` Stephen Boyd 1 sibling, 1 reply; 5+ 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] 5+ messages in thread
* Re: [PATCH 2/2] clk: tegra: delete unneeded of_node_put 2015-10-09 17:47 ` [PATCH 2/2] clk: " Julia Lawall @ 2015-10-12 18:52 ` Stephen Boyd 0 siblings, 0 replies; 5+ 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] 5+ messages in thread
end of thread, other threads:[~2016-06-14 9:38 UTC | newest] Thread overview: 5+ 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 1/2] memory: tegra: " Julia Lawall 2016-06-14 9:38 ` Thierry Reding 2015-10-09 17:47 ` [PATCH 2/2] clk: " 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).