Skip to content

Commit

Permalink
ALSA: snd-usb-caiaq: Fix the return of XRUN
Browse files Browse the repository at this point in the history
Commit 3702b08 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: Mark Hills <[email protected]>
Acked-by: Daniel Mack <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
Mark Hills authored and tiwai committed Feb 22, 2012
1 parent fe879e2 commit cb74eb1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sound/usb/caiaq/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,10 @@ snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub)

spin_lock(&dev->spinlock);

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

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

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

0 comments on commit cb74eb1

Please sign in to comment.