Commit 53ba2aa3 authored by Julia Lawall's avatar Julia Lawall Committed by Mark Brown

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: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5771a8c0
...@@ -394,13 +394,16 @@ int rsnd_ctu_probe(struct rsnd_priv *priv) ...@@ -394,13 +394,16 @@ int rsnd_ctu_probe(struct rsnd_priv *priv)
clk = devm_clk_get(dev, name); clk = devm_clk_get(dev, name);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
ret = PTR_ERR(clk); ret = PTR_ERR(clk);
of_node_put(np);
goto rsnd_ctu_probe_done; goto rsnd_ctu_probe_done;
} }
ret = rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops, ret = rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops,
clk, rsnd_mod_get_status, RSND_MOD_CTU, i); clk, rsnd_mod_get_status, RSND_MOD_CTU, i);
if (ret) if (ret) {
of_node_put(np);
goto rsnd_ctu_probe_done; goto rsnd_ctu_probe_done;
}
i++; i++;
} }
......
...@@ -380,13 +380,16 @@ int rsnd_dvc_probe(struct rsnd_priv *priv) ...@@ -380,13 +380,16 @@ int rsnd_dvc_probe(struct rsnd_priv *priv)
clk = devm_clk_get(dev, name); clk = devm_clk_get(dev, name);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
ret = PTR_ERR(clk); ret = PTR_ERR(clk);
of_node_put(np);
goto rsnd_dvc_probe_done; goto rsnd_dvc_probe_done;
} }
ret = rsnd_mod_init(priv, rsnd_mod_get(dvc), &rsnd_dvc_ops, ret = rsnd_mod_init(priv, rsnd_mod_get(dvc), &rsnd_dvc_ops,
clk, rsnd_mod_get_status, RSND_MOD_DVC, i); clk, rsnd_mod_get_status, RSND_MOD_DVC, i);
if (ret) if (ret) {
of_node_put(np);
goto rsnd_dvc_probe_done; goto rsnd_dvc_probe_done;
}
i++; i++;
} }
......
...@@ -168,13 +168,16 @@ int rsnd_mix_probe(struct rsnd_priv *priv) ...@@ -168,13 +168,16 @@ int rsnd_mix_probe(struct rsnd_priv *priv)
clk = devm_clk_get(dev, name); clk = devm_clk_get(dev, name);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
ret = PTR_ERR(clk); ret = PTR_ERR(clk);
of_node_put(np);
goto rsnd_mix_probe_done; goto rsnd_mix_probe_done;
} }
ret = rsnd_mod_init(priv, rsnd_mod_get(mix), &rsnd_mix_ops, ret = rsnd_mod_init(priv, rsnd_mod_get(mix), &rsnd_mix_ops,
clk, rsnd_mod_get_status, RSND_MOD_MIX, i); clk, rsnd_mod_get_status, RSND_MOD_MIX, i);
if (ret) if (ret) {
of_node_put(np);
goto rsnd_mix_probe_done; goto rsnd_mix_probe_done;
}
i++; i++;
} }
......
...@@ -581,20 +581,24 @@ int rsnd_src_probe(struct rsnd_priv *priv) ...@@ -581,20 +581,24 @@ int rsnd_src_probe(struct rsnd_priv *priv)
src->irq = irq_of_parse_and_map(np, 0); src->irq = irq_of_parse_and_map(np, 0);
if (!src->irq) { if (!src->irq) {
ret = -EINVAL; ret = -EINVAL;
of_node_put(np);
goto rsnd_src_probe_done; goto rsnd_src_probe_done;
} }
clk = devm_clk_get(dev, name); clk = devm_clk_get(dev, name);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
ret = PTR_ERR(clk); ret = PTR_ERR(clk);
of_node_put(np);
goto rsnd_src_probe_done; goto rsnd_src_probe_done;
} }
ret = rsnd_mod_init(priv, rsnd_mod_get(src), ret = rsnd_mod_init(priv, rsnd_mod_get(src),
&rsnd_src_ops, clk, rsnd_mod_get_status, &rsnd_src_ops, clk, rsnd_mod_get_status,
RSND_MOD_SRC, i); RSND_MOD_SRC, i);
if (ret) if (ret) {
of_node_put(np);
goto rsnd_src_probe_done; goto rsnd_src_probe_done;
}
skip: skip:
i++; i++;
......
...@@ -1079,6 +1079,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) ...@@ -1079,6 +1079,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
clk = devm_clk_get(dev, name); clk = devm_clk_get(dev, name);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
ret = PTR_ERR(clk); ret = PTR_ERR(clk);
of_node_put(np);
goto rsnd_ssi_probe_done; goto rsnd_ssi_probe_done;
} }
...@@ -1091,6 +1092,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) ...@@ -1091,6 +1092,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
ssi->irq = irq_of_parse_and_map(np, 0); ssi->irq = irq_of_parse_and_map(np, 0);
if (!ssi->irq) { if (!ssi->irq) {
ret = -EINVAL; ret = -EINVAL;
of_node_put(np);
goto rsnd_ssi_probe_done; goto rsnd_ssi_probe_done;
} }
...@@ -1101,8 +1103,10 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) ...@@ -1101,8 +1103,10 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
ret = rsnd_mod_init(priv, rsnd_mod_get(ssi), ops, clk, ret = rsnd_mod_init(priv, rsnd_mod_get(ssi), ops, clk,
rsnd_ssi_get_status, RSND_MOD_SSI, i); rsnd_ssi_get_status, RSND_MOD_SSI, i);
if (ret) if (ret) {
of_node_put(np);
goto rsnd_ssi_probe_done; goto rsnd_ssi_probe_done;
}
i++; i++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment