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

ALSA: sparc: fix missing unlock on error in snd_cs4231_playback_prepare()

Add the missing unlock before return from function
snd_cs4231_playback_prepare() in the error handling
case.

Fixes: 5a19b178d7b4 ('ALSA: sparc/cs4231: Use WARN_ON() instead of BUG_ON()')
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Wei Yongjun and committed by
Takashi Iwai
a522409e 0c52db8c

+8 -3
+8 -3
sound/sparc/cs4231.c
··· 907 907 struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); 908 908 struct snd_pcm_runtime *runtime = substream->runtime; 909 909 unsigned long flags; 910 + int ret = 0; 910 911 911 912 spin_lock_irqsave(&chip->lock, flags); 912 913 913 914 chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | 914 915 CS4231_PLAYBACK_PIO); 915 916 916 - if (WARN_ON(runtime->period_size > 0xffff + 1)) 917 - return -EINVAL; 917 + if (WARN_ON(runtime->period_size > 0xffff + 1)) { 918 + ret = -EINVAL; 919 + goto out; 920 + } 918 921 919 922 chip->p_periods_sent = 0; 923 + 924 + out: 920 925 spin_unlock_irqrestore(&chip->lock, flags); 921 926 922 - return 0; 927 + return ret; 923 928 } 924 929 925 930 static int snd_cs4231_capture_hw_params(struct snd_pcm_substream *substream,