Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb74eb15 authored by Mark Hills's avatar Mark Hills Committed by Takashi Iwai
Browse files

ALSA: snd-usb-caiaq: Fix the return of XRUN



Commit 3702b082 added a lock, but did not account for the case of
SNDRV_PCM_POS_XRUN, which would get immediately overwritten.

This could be bundled into one if-else-if statement, but the goto
helps to clarify the 'exceptional' case.

Thanks to Andreas Pape for spotting this.

Signed-off-by: default avatarMark Hills <mark@pogo.org.uk>
Acked-by: default avatarDaniel Mack <zonque@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent fe879e2f
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -311,8 +311,10 @@ snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub)


	spin_lock(&dev->spinlock);
	spin_lock(&dev->spinlock);


	if (dev->input_panic || dev->output_panic)
	if (dev->input_panic || dev->output_panic) {
		ptr = SNDRV_PCM_POS_XRUN;
		ptr = SNDRV_PCM_POS_XRUN;
		goto unlock;
	}


	if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
	if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
		ptr = bytes_to_frames(sub->runtime,
		ptr = bytes_to_frames(sub->runtime,
@@ -321,6 +323,7 @@ snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub)
		ptr = bytes_to_frames(sub->runtime,
		ptr = bytes_to_frames(sub->runtime,
					dev->audio_in_buf_pos[index]);
					dev->audio_in_buf_pos[index]);


unlock:
	spin_unlock(&dev->spinlock);
	spin_unlock(&dev->spinlock);
	return ptr;
	return ptr;
}
}