diff mbox

[106/237] ASoC: rcar: add ID check on rsnd_dai_get()

Message ID 1387000406-29111-107-git-send-email-horms+renesas@verge.net.au (mailing list archive)
State New, archived
Headers show

Commit Message

Simon Horman Dec. 14, 2013, 5:51 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

checking id in rsnd_dai_get() is good idea

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 2192f81c53a7879c803f0f7d6c49645fdf6c2f6a)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 sound/soc/sh/rcar/core.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 0fb8bbf..7c3fa72 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -363,6 +363,9 @@  int rsnd_dai_id(struct rsnd_priv *priv, struct rsnd_dai *rdai)
 
 struct rsnd_dai *rsnd_dai_get(struct rsnd_priv *priv, int id)
 {
+	if ((id < 0) || (id >= rsnd_dai_nr(priv)))
+		return NULL;
+
 	return priv->rdai + id;
 }