[alsa-devel] [PATCH 12/31] ASoC: wm9713: Use WARN_ON() instead of BUG_ON()

Takashi Iwai tiwai at suse.de
Tue Nov 5 18:39:59 CET 2013


BUG_ON() is rather useless for debugging as it leads to panic().
Use WARN_ON() and handle the error cases accordingly.

Cc: patches at opensource.wolfsonmicro.com
Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 sound/soc/codecs/wm9713.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index a53e175c015a..acea8927905b 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -221,7 +221,8 @@ static int wm9713_voice_shutdown(struct snd_soc_dapm_widget *w,
 	struct snd_soc_codec *codec = w->codec;
 	u16 status, rate;
 
-	BUG_ON(event != SND_SOC_DAPM_PRE_PMD);
+	if (WARN_ON(event != SND_SOC_DAPM_PRE_PMD))
+		return -EINVAL;
 
 	/* Gracefully shut down the voice interface. */
 	status = ac97_read(codec, AC97_EXTENDED_MID) | 0x1000;
-- 
1.8.4.2



More information about the Alsa-devel mailing list