diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 28c24fcf8bc78e44efe6a376070cb430a1d83398..b234ed663073e76068830d56a806567856e4f62d 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -318,6 +318,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;
 }