ASoC: rcar: Use WARN_ON() instead of BUG_ON()
authorTakashi Iwai <tiwai@suse.de>
Tue, 5 Nov 2013 17:40:05 +0000 (18:40 +0100)
committerMark Brown <broonie@linaro.org>
Thu, 7 Nov 2013 19:55:16 +0000 (19:55 +0000)
Use WARN_ON() and handle the error cases accordingly.

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/sh/rcar/scu.c
sound/soc/sh/rcar/ssi.c

index 2df2e9150b893498ffbc15991b1a47e2f9dfd47a..92e3f51c3a4f14b1e8a4a04bf15204540b6cf252 100644 (file)
@@ -192,7 +192,8 @@ static struct rsnd_mod_ops rsnd_scu_ops = {
 
 struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id)
 {
-       BUG_ON(id < 0 || id >= rsnd_scu_nr(priv));
+       if (WARN_ON(id < 0 || id >= rsnd_scu_nr(priv)))
+               id = 0;
 
        return &((struct rsnd_scu *)(priv->scu) + id)->mod;
 }
index fae26d3f79d26bf827cc931bd16fe186800f777d..fc010d652069bfe658eb688ecf42ebaeef20c7d1 100644 (file)
@@ -619,7 +619,8 @@ struct rsnd_mod *rsnd_ssi_mod_get_frm_dai(struct rsnd_priv *priv,
 
 struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id)
 {
-       BUG_ON(id < 0 || id >= rsnd_ssi_nr(priv));
+       if (WARN_ON(id < 0 || id >= rsnd_ssi_nr(priv)))
+               id = 0;
 
        return &(((struct rsnd_ssiu *)(priv->ssiu))->ssi + id)->mod;
 }