Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: sparc/cs4231: Use WARN_ON() instead of BUG_ON()

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

Signed-off-by: Takashi Iwai <tiwai@suse.de>

+4 -2
+4 -2
sound/sparc/cs4231.c
··· 429 429 unsigned int period_size = snd_pcm_lib_period_bytes(substream); 430 430 unsigned int offset = period_size * (*periods_sent); 431 431 432 - BUG_ON(period_size >= (1 << 24)); 432 + if (WARN_ON(period_size >= (1 << 24))) 433 + return; 433 434 434 435 if (dma_cont->request(dma_cont, 435 436 runtime->dma_addr + offset, period_size)) ··· 913 912 chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | 914 913 CS4231_PLAYBACK_PIO); 915 914 916 - BUG_ON(runtime->period_size > 0xffff + 1); 915 + if (WARN_ON(runtime->period_size > 0xffff + 1)) 916 + return -EINVAL; 917 917 918 918 chip->p_periods_sent = 0; 919 919 spin_unlock_irqrestore(&chip->lock, flags);