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

Takashi Iwai tiwai at suse.de
Tue Nov 5 18:40:03 CET 2013


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

Cc: Eric Miao <eric.y.miao at gmail.com>
Cc: Russell King <linux at arm.linux.org.uk>
Cc: Haojian Zhuang <haojian.zhuang at gmail.com>
Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 sound/soc/pxa/pxa2xx-i2s.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index d5340a088858..c0d648d3339f 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -165,7 +165,8 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
 {
 	struct snd_dmaengine_dai_dma_data *dma_data;
 
-	BUG_ON(IS_ERR(clk_i2s));
+	if (WARN_ON(IS_ERR(clk_i2s)))
+		return -EINVAL;
 	clk_prepare_enable(clk_i2s);
 	clk_ena = 1;
 	pxa_i2s_wait();
-- 
1.8.4.2



More information about the Alsa-devel mailing list