alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* Re: ASoC: add Renesas R-Car module feature
@ 2013-11-08 10:02 Dan Carpenter
  2013-11-11  1:00 ` [PATCH] ASoC: rcar: fixup mod access before checking Kuninori Morimoto
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2013-11-08 10:02 UTC (permalink / raw)
  To: kuninori.morimoto.gx; +Cc: alsa-devel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] ASoC: rcar: fixup mod access before checking
  2013-11-08 10:02 ASoC: add Renesas R-Car module feature Dan Carpenter
@ 2013-11-11  1:00 ` Kuninori Morimoto
  2013-11-12 11:19   ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Kuninori Morimoto @ 2013-11-11  1:00 UTC (permalink / raw)
  To: Mark Brown, Dan Carpenter
  Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto

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

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 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 a357060..9134e80 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -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));
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: rcar: fixup mod access before checking
  2013-11-11  1:00 ` [PATCH] ASoC: rcar: fixup mod access before checking Kuninori Morimoto
@ 2013-11-12 11:19   ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2013-11-12 11:19 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Linux-ALSA, Simon, Liam Girdwood, Dan Carpenter,
	Kuninori Morimoto


[-- Attachment #1.1: Type: text/plain, Size: 166 bytes --]

On Sun, Nov 10, 2013 at 05:00:42PM -0800, Kuninori Morimoto wrote:
> rsnd_dai_connect() is using mod before NULL checking.
> This patch fixes it up

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-12 11:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-08 10:02 ASoC: add Renesas R-Car module feature Dan Carpenter
2013-11-11  1:00 ` [PATCH] ASoC: rcar: fixup mod access before checking Kuninori Morimoto
2013-11-12 11:19   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).