diff mbox

[1/3] rcar: ctu: Avoid use of ret uninitialised

Message ID 1450094851-27525-1-git-send-email-broonie@kernel.org (mailing list archive)
State Accepted
Commit 76ca9970322118610681af5f929aba62f346082b
Headers show

Commit Message

Mark Brown Dec. 14, 2015, 12:07 p.m. UTC
We use ret as the return value from the rsnd_ctu_probe() but if there
are no child nodes and no errors then we will never initialize ret leading
to build warnings. Ensure ret is initialized before we iterate over the
child nodes to avoid this.

Signed-off-by: Mark Brown <broonie@kernel.org>
---

Perhaps this should be an error instead?  It's not like it's a sensible
configuration...

 sound/soc/sh/rcar/ctu.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Kuninori Morimoto Dec. 14, 2015, 11:32 p.m. UTC | #1
Hi Mark

> We use ret as the return value from the rsnd_ctu_probe() but if there
> are no child nodes and no errors then we will never initialize ret leading
> to build warnings. Ensure ret is initialized before we iterate over the
> child nodes to avoid this.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---

I didn't notice about this issue.
Thanks

> Perhaps this should be an error instead?  It's not like it's a sensible
> configuration...

No DVC, No CTU, No MIX are not error in my opinion.

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Kuninori Morimoto Dec. 14, 2015, 11:36 p.m. UTC | #2
Hi Mark again

> We use ret as the return value from the rsnd_ctu_probe() but if there
> are no child nodes and no errors then we will never initialize ret leading
> to build warnings. Ensure ret is initialized before we iterate over the
> child nodes to avoid this.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---

This is just comment.
It will return 0 if there is no child nodes

	node = rsnd_ctu_of_node(priv);
	if (!node)
		return 0; /* not used is not error */
	...

  	for_each_child_of_node(node, np) {
		...
diff mbox

Patch

diff --git a/sound/soc/sh/rcar/ctu.c b/sound/soc/sh/rcar/ctu.c
index 7c1e190cd389..d53a225d19e9 100644
--- a/sound/soc/sh/rcar/ctu.c
+++ b/sound/soc/sh/rcar/ctu.c
@@ -111,6 +111,7 @@  int rsnd_ctu_probe(struct rsnd_priv *priv)
 	priv->ctu	= ctu;
 
 	i = 0;
+	ret = 0;
 	for_each_child_of_node(node, np) {
 		ctu = rsnd_ctu_get(priv, i);