ASoC: txx9: Use WARN_ON() instead of BUG_ON()
authorTakashi Iwai <tiwai@suse.de>
Tue, 5 Nov 2013 17:40:07 +0000 (18:40 +0100)
committerMark Brown <broonie@linaro.org>
Thu, 7 Nov 2013 19:55:17 +0000 (19:55 +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/txx9/txx9aclc.c

index 45a6428..fbd077f 100644 (file)
@@ -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);