[alsa-devel] [PATCH 18/31] ASoC: rcar: Use WARN_ON() instead of BUG_ON()
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Wed Nov 6 01:22:44 CET 2013
At Tue, 5 Nov 2013 18:40:05 +0100,
Takashi Iwai wrote:
>
> BUG_ON() is rather useless for debugging as it leads to panic().
> Use WARN_ON() and handle the error cases accordingly.
>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> Signed-off-by: Takashi Iwai <tiwai at suse.de>
> ---
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> 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.4.2
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
More information about the Alsa-devel
mailing list