Skip to contentSkip to conversation

ASoC: add Renesas R-Car module feature

PATCH Applied Dan Carpenter 3 participants 3 messages Nov 8, 2013 – Nov 12, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hello Kuninori Morimoto,

This is a semi-automatic email about new static checker warnings.

The patch cdaa3cdfb4a7: "ASoC: add Renesas R-Car module feature" from Jul 21, 2013, leads to the following Smatch complaint:

sound/soc/sh/rcar/core.c:294 rsnd_dai_connect()
warn: variable dereferenced before check 'mod' (see line 291)

sound/soc/sh/rcar/core.c
290 {

   291		struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
                                         ^^^^^^^^^^^^^^^^^^^^^

Dereference.

292 struct device *dev = rsnd_priv_to_dev(priv);
293

   294		if (!mod) {
                    ^^^^

Check.

   295			dev_err(dev, "NULL mod\n");
   296			return -EIO;

regards,
dan carpenter

#1 lore raw

PATCH 1/1 ASoC: rcar: fixup mod access before checking

rsnd_dai_connect() is using mod before NULL checking. This patch fixes it up

---
 sound/soc/sh/rcar/core.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
sound/soc/sh/rcar/core.c +4 -6
index a357060..9134e80 100644
@@ -324,15 +324,13 @@ int rsnd_dai_connect(struct rsnd_dai *rdai,
 		     struct rsnd_mod *mod,
 		     struct rsnd_dai_stream *io)
 {
-	struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
-	struct device *dev = rsnd_priv_to_dev(priv);
-
-	if (!mod) {
-		dev_err(dev, "NULL mod\n");
+	if (!mod)
 		return -EIO;
-	}
 
 	if (!list_empty(&mod->list)) {
+		struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
+		struct device *dev = rsnd_priv_to_dev(priv);
+
 		dev_err(dev, "%s%d is not empty\n",
 			rsnd_mod_name(mod),
 			rsnd_mod_id(mod));
Signature · 1 line
1.7.9.5
maintainer Applied
#2 lore raw

Re: [PATCH] ASoC: rcar: fixup mod access before checking

Quoted 2 lines · Kuninori Morimoto

rsnd_dai_connect() is using mod before NULL checking. This patch fixes it up

Applied, thanks.