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>
This commit is contained in:
parent
5771a8c088
commit
53ba2aa314
|
@ -394,13 +394,16 @@ int rsnd_ctu_probe(struct rsnd_priv *priv)
|
|||
clk = devm_clk_get(dev, name);
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
of_node_put(np);
|
||||
goto rsnd_ctu_probe_done;
|
||||
}
|
||||
|
||||
ret = rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops,
|
||||
clk, rsnd_mod_get_status, RSND_MOD_CTU, i);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
of_node_put(np);
|
||||
goto rsnd_ctu_probe_done;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -380,13 +380,16 @@ int rsnd_dvc_probe(struct rsnd_priv *priv)
|
|||
clk = devm_clk_get(dev, name);
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
of_node_put(np);
|
||||
goto rsnd_dvc_probe_done;
|
||||
}
|
||||
|
||||
ret = rsnd_mod_init(priv, rsnd_mod_get(dvc), &rsnd_dvc_ops,
|
||||
clk, rsnd_mod_get_status, RSND_MOD_DVC, i);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
of_node_put(np);
|
||||
goto rsnd_dvc_probe_done;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -168,13 +168,16 @@ int rsnd_mix_probe(struct rsnd_priv *priv)
|
|||
clk = devm_clk_get(dev, name);
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
of_node_put(np);
|
||||
goto rsnd_mix_probe_done;
|
||||
}
|
||||
|
||||
ret = rsnd_mod_init(priv, rsnd_mod_get(mix), &rsnd_mix_ops,
|
||||
clk, rsnd_mod_get_status, RSND_MOD_MIX, i);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
of_node_put(np);
|
||||
goto rsnd_mix_probe_done;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -1079,6 +1079,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
|
|||
clk = devm_clk_get(dev, name);
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
of_node_put(np);
|
||||
goto rsnd_ssi_probe_done;
|
||||
}
|
||||
|
||||
|
@ -1091,6 +1092,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
|
|||
ssi->irq = irq_of_parse_and_map(np, 0);
|
||||
if (!ssi->irq) {
|
||||
ret = -EINVAL;
|
||||
of_node_put(np);
|
||||
goto rsnd_ssi_probe_done;
|
||||
}
|
||||
|
||||
|
@ -1101,8 +1103,10 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
|
|||
|
||||
ret = rsnd_mod_init(priv, rsnd_mod_get(ssi), ops, clk,
|
||||
rsnd_ssi_get_status, RSND_MOD_SSI, i);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
of_node_put(np);
|
||||
goto rsnd_ssi_probe_done;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue