ASoC: rcar: fixup mod access before checking

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Nov 22 17:59:12 EST 2013


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=6020779b118f6221e5d067bd1e6b44bab6fc0276
Commit:     6020779b118f6221e5d067bd1e6b44bab6fc0276
Parent:     9645083ca5ef365b7b750cf219bb20b61bb925f8
Author:     Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
AuthorDate: Sun Nov 10 17:00:42 2013 -0800
Committer:  Mark Brown <broonie at linaro.org>
CommitDate: Mon Nov 18 11:10:39 2013 +0000

    ASoC: rcar: fixup mod access before checking
    
    rsnd_dai_connect() is using mod before NULL checking.
    This patch fixes it up
    
    Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
    Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
    Signed-off-by: Mark Brown <broonie at linaro.org>
---
 sound/soc/sh/rcar/core.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index b234ed6..2e09ee8 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -279,15 +279,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));



More information about the linux-mtd-cvs mailing list