From cb1b10262f986f865fdbafd0af3327f15f83b8af Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 5 Nov 2013 18:40:07 +0100 Subject: [PATCH] ASoC: txx9: Use WARN_ON() instead of BUG_ON() Use WARN_ON() and handle the error cases accordingly. Signed-off-by: Takashi Iwai Signed-off-by: Mark Brown --- sound/soc/txx9/txx9aclc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c index 45a6428cba8d..fbd077f4de72 100644 --- a/sound/soc/txx9/txx9aclc.c +++ b/sound/soc/txx9/txx9aclc.c @@ -115,8 +115,8 @@ static void txx9aclc_dma_complete(void *arg) spin_lock_irqsave(&dmadata->dma_lock, flags); if (dmadata->frag_count >= 0) { dmadata->dmacount--; - BUG_ON(dmadata->dmacount < 0); - tasklet_schedule(&dmadata->tasklet); + if (!WARN_ON(dmadata->dmacount < 0)) + tasklet_schedule(&dmadata->tasklet); } spin_unlock_irqrestore(&dmadata->dma_lock, flags); } @@ -181,7 +181,10 @@ static void txx9aclc_dma_tasklet(unsigned long data) spin_unlock_irqrestore(&dmadata->dma_lock, flags); return; } - BUG_ON(dmadata->dmacount >= NR_DMA_CHAIN); + if (WARN_ON(dmadata->dmacount >= NR_DMA_CHAIN)) { + spin_unlock_irqrestore(&dmadata->dma_lock, flags); + return; + } while (dmadata->dmacount < NR_DMA_CHAIN) { dmadata->dmacount++; spin_unlock_irqrestore(&dmadata->dma_lock, flags); -- 2.20.1