* [PATCH] clk: tegra: clk-emc: Add missing of_node_put
@ 2016-01-24 15:15 Amitoj Kaur Chawla
2016-01-25 12:55 ` Thierry Reding
0 siblings, 1 reply; 2+ messages in thread
From: Amitoj Kaur Chawla @ 2016-01-24 15:15 UTC (permalink / raw)
To: pdeschrijver, pgaikwad, mturquette, sboyd, swarren,
thierry.reding, gnurou, linux-clk, linux-tegra, linux-kernel
Cc: julia.lawall
for_each_child_of_node performs an of_node_get on each iteration, so
to break out of the loop an of_node_put is required.
Found using Coccinelle. The semantic patch used for this is as follows:
// <smpl>
@@
expression e;
local idexpression child;
@@
for_each_child_of_node(root, child) {
... when != of_node_put(child)
when != e = child
(
return child;
|
+ of_node_put(child);
? return ...;
)
...
}
// </smpl>
Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
drivers/clk/tegra/clk-emc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/tegra/clk-emc.c b/drivers/clk/tegra/clk-emc.c
index 138a94b..6aaccf9 100644
--- a/drivers/clk/tegra/clk-emc.c
+++ b/drivers/clk/tegra/clk-emc.c
@@ -450,8 +450,10 @@ static int load_timings_from_dt(struct tegra_clk_emc *tegra,
struct emc_timing *timing = tegra->timings + (i++);
err = load_one_timing_from_dt(tegra, timing, child);
- if (err)
+ if (err) {
+ of_node_put(child);
return err;
+ }
timing->ram_code = ram_code;
}
@@ -501,9 +503,9 @@ struct clk *tegra_clk_register_emc(void __iomem *base, struct device_node *np,
* fuses until the apbmisc driver is loaded.
*/
err = load_timings_from_dt(tegra, node, node_ram_code);
+ of_node_put(node);
if (err)
return ERR_PTR(err);
- of_node_put(node);
break;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] clk: tegra: clk-emc: Add missing of_node_put
2016-01-24 15:15 [PATCH] clk: tegra: clk-emc: Add missing of_node_put Amitoj Kaur Chawla
@ 2016-01-25 12:55 ` Thierry Reding
0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2016-01-25 12:55 UTC (permalink / raw)
To: Amitoj Kaur Chawla
Cc: pdeschrijver, pgaikwad, mturquette, sboyd, swarren, gnurou,
linux-clk, linux-tegra, linux-kernel, julia.lawall
[-- Attachment #1: Type: text/plain, Size: 768 bytes --]
On Sun, Jan 24, 2016 at 08:45:20PM +0530, Amitoj Kaur Chawla wrote:
> for_each_child_of_node performs an of_node_get on each iteration, so
> to break out of the loop an of_node_put is required.
>
> Found using Coccinelle. The semantic patch used for this is as follows:
>
> // <smpl>
> @@
> expression e;
> local idexpression child;
> @@
>
> for_each_child_of_node(root, child) {
> ... when != of_node_put(child)
> when != e = child
> (
> return child;
> |
> + of_node_put(child);
> ? return ...;
> )
> ...
> }
> // </smpl>
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
> drivers/clk/tegra/clk-emc.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Applied, thanks.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-25 12:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-24 15:15 [PATCH] clk: tegra: clk-emc: Add missing of_node_put Amitoj Kaur Chawla
2016-01-25 12:55 ` Thierry Reding
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.