diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2017-07-15 09:19:07 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-07-17 15:39:51 +0100 |
commit | 53ba2aa314164f7fcd3acf9594313811256a52c4 (patch) | |
tree | be856198f390b83ace8884e59fa689b1562c5578 /sound/soc/sh/rcar/src.c | |
parent | 5771a8c08880cdca3bfb4a3fc6d309d6bba20877 (diff) |
ASoC: rsnd: add missing of_node_put
for_each_child_of_node performs an of_node_get on each iteration, so a
jump out of the loop requires an of_node_put.
The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):
// <smpl>
@@
local idexpression n;
expression e,e1;
identifier l;
@@
for_each_child_of_node(e1,n) {
...
(
of_node_put(n);
|
e = n
|
+ of_node_put(n);
? goto l;
)
...
}
...
l: ... when != n
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sh/rcar/src.c')
-rw-r--r-- | sound/soc/sh/rcar/src.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index 7aa239e28491..8e9a1de0ec25 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -581,20 +581,24 @@ int rsnd_src_probe(struct rsnd_priv *priv) src->irq = irq_of_parse_and_map(np, 0); if (!src->irq) { ret = -EINVAL; + of_node_put(np); goto rsnd_src_probe_done; } clk = devm_clk_get(dev, name); if (IS_ERR(clk)) { ret = PTR_ERR(clk); + of_node_put(np); goto rsnd_src_probe_done; } ret = rsnd_mod_init(priv, rsnd_mod_get(src), &rsnd_src_ops, clk, rsnd_mod_get_status, RSND_MOD_SRC, i); - if (ret) + if (ret) { + of_node_put(np); goto rsnd_src_probe_done; + } skip: i++; |