ASoC: max98095: Use WARN_ON() instead of BUG_ON()
authorTakashi Iwai <tiwai@suse.de>
Tue, 5 Nov 2013 17:39:50 +0000 (18:39 +0100)
committerMark Brown <broonie@linaro.org>
Wed, 6 Nov 2013 10:26:16 +0000 (10:26 +0000)
Use WARN_ON() and handle the error cases accordingly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/codecs/max98095.c

index 8dbcacd..04618a5 100644 (file)
@@ -637,8 +637,9 @@ static void m98095_eq_band(struct snd_soc_codec *codec, unsigned int dai,
        unsigned int eq_reg;
        unsigned int i;
 
-       BUG_ON(band > 4);
-       BUG_ON(dai > 1);
+       if (WARN_ON(band > 4) ||
+           WARN_ON(dai > 1))
+               return;
 
        /* Load the base register address */
        eq_reg = dai ? M98095_142_DAI2_EQ_BASE : M98095_110_DAI1_EQ_BASE;
@@ -662,8 +663,9 @@ static void m98095_biquad_band(struct snd_soc_codec *codec, unsigned int dai,
        unsigned int bq_reg;
        unsigned int i;
 
-       BUG_ON(band > 1);
-       BUG_ON(dai > 1);
+       if (WARN_ON(band > 1) ||
+           WARN_ON(dai > 1))
+               return;
 
        /* Load the base register address */
        bq_reg = dai ? M98095_17E_DAI2_BQ_BASE : M98095_174_DAI1_BQ_BASE;
@@ -1011,7 +1013,8 @@ static int max98095_line_pga(struct snd_soc_dapm_widget *w,
        struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
        u8 *state;
 
-       BUG_ON(!((channel == 1) || (channel == 2)));
+       if (WARN_ON(!(channel == 1 || channel == 2)))
+               return -EINVAL;
 
        state = &max98095->lin_state;
 
@@ -1868,7 +1871,8 @@ static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol,
        int fs, best, best_val, i;
        int regmask, regsave;
 
-       BUG_ON(channel > 1);
+       if (WARN_ON(channel > 1))
+               return -EINVAL;
 
        if (!pdata || !max98095->eq_textcnt)
                return 0;