Skip to content

Commit 6020779

Browse files
morimotobroonie
authored andcommitted
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@oracle.com> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@linaro.org>
1 parent 9645083 commit 6020779

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

sound/soc/sh/rcar/core.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,13 @@ int rsnd_dai_connect(struct rsnd_dai *rdai,
279279
struct rsnd_mod *mod,
280280
struct rsnd_dai_stream *io)
281281
{
282-
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
283-
struct device *dev = rsnd_priv_to_dev(priv);
284-
285-
if (!mod) {
286-
dev_err(dev, "NULL mod\n");
282+
if (!mod)
287283
return -EIO;
288-
}
289284

290285
if (!list_empty(&mod->list)) {
286+
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
287+
struct device *dev = rsnd_priv_to_dev(priv);
288+
291289
dev_err(dev, "%s%d is not empty\n",
292290
rsnd_mod_name(mod),
293291
rsnd_mod_id(mod));

0 commit comments

Comments
 (0)