| From 58c7bf485d795a3ca0283fc3c72f47704a0e0aa0 Mon Sep 17 00:00:00 2001 |
| From: Takashi Iwai <tiwai@suse.de> |
| Date: Tue, 5 Nov 2013 18:40:05 +0100 |
| Subject: ASoC: rcar: Use WARN_ON() instead of BUG_ON() |
| |
| 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> |
| (cherry picked from commit 8b14719bebfe022f3637c323e76c88b2bc061a61) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| sound/soc/sh/rcar/scu.c | 3 ++- |
| sound/soc/sh/rcar/ssi.c | 3 ++- |
| 2 files changed, 4 insertions(+), 2 deletions(-) |
| |
| diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c |
| index 1ab1bce6be7f..f4453e33a847 100644 |
| --- a/sound/soc/sh/rcar/scu.c |
| +++ b/sound/soc/sh/rcar/scu.c |
| @@ -198,7 +198,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; |
| } |
| diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c |
| index b71cf9d7dd3f..5ac20cd5e006 100644 |
| --- a/sound/soc/sh/rcar/ssi.c |
| +++ b/sound/soc/sh/rcar/ssi.c |
| @@ -611,7 +611,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; |
| } |
| -- |
| 1.8.5.rc3 |
| |