summaryrefslogtreecommitdiff
path: root/sound/soc/sh/rcar/cmd.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2017-05-17 06:50:32 +0000
committerMark Brown <broonie@kernel.org>2017-05-17 10:30:47 +0100
commit374503c6109e60f48fa9b11341b14466f07bd3f4 (patch)
treee05a504d060731ff7f464ddde7b502da50093637 /sound/soc/sh/rcar/cmd.c
parent2adcea7e22d382e2becf5671e92296f79672b957 (diff)
ASoC: rsnd: check src mod pointer for rsnd_mod_id()
Without this patch, gcc 4.9.x says sound/soc/sh/rcar/cmd.c: In function 'rsnd_cmd_init': sound/soc/sh/rcar/cmd.c:85:14: warning: array subscript is below array\ bounds [-Warray-bounds] data = path[rsnd_mod_id(src)] | Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sh/rcar/cmd.c')
-rw-r--r--sound/soc/sh/rcar/cmd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/soc/sh/rcar/cmd.c b/sound/soc/sh/rcar/cmd.c
index 7d92a24b7cfa..98835e9d1d7d 100644
--- a/sound/soc/sh/rcar/cmd.c
+++ b/sound/soc/sh/rcar/cmd.c
@@ -82,6 +82,9 @@ static int rsnd_cmd_init(struct rsnd_mod *mod,
[9] = 0x2,
};
+ if (unlikely(!src))
+ return -EIO;
+
data = path[rsnd_mod_id(src)] |
cmd_case[rsnd_mod_id(src)] << 16;
}