ALSA: pcm: Call snd_pcm_sync_stop outside spinlock in snd_pcm_drop()
PATCH 1/1 ALSA: pcm: Call snd_pcm_sync_stop outside spinlock in snd_pcm_drop()
In the recent addition of snd_pcm_sync_stop() call at snd_pcm_drop(), I overlooked the guard() line in snd_pcm_drop() (and the review overlooked, too) -- it must be called outside, of course!
Let's fix it. Now guard() became scoped_guard(), and its range is shown more clearly.
Fixes fdf9a21cda78 ("ALSA: pcm: Apply sync-stop at SNDRV_PCM_IOCTL_DROP ioctl")
Reported-by Marek Szyprowski <[email protected]>
Signed-off-by Takashi Iwai <[email protected]>
--- sound/core/pcm_native.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
sound/core/pcm_native.c +10 -9
@@ -2307,17 +2307,18 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)return -ENXIO ; runtime = substream->runtime; -guard (pcm_stream_lock_irq)(substream); -if (runtime->state ==SNDRV_PCM_STATE_OPEN || - runtime->state ==SNDRV_PCM_STATE_DISCONNECTED ) -return -EBADFD ; + scoped_guard(pcm_stream_lock_irq, substream) { +if (runtime->state ==SNDRV_PCM_STATE_OPEN || + runtime->state ==SNDRV_PCM_STATE_DISCONNECTED ) +return -EBADFD ; -/* resume pause */ -if (runtime->state ==SNDRV_PCM_STATE_PAUSED ) -snd_pcm_pause (substream, false); +/* resume pause */ +if (runtime->state ==SNDRV_PCM_STATE_PAUSED ) +snd_pcm_pause (substream, false); - result =snd_pcm_stop (substream,SNDRV_PCM_STATE_SETUP ); -/* runtime->control->appl_ptr = runtime->status->hw_ptr; */ + result =snd_pcm_stop (substream,SNDRV_PCM_STATE_SETUP ); +/* runtime->control->appl_ptr = runtime->status->hw_ptr; */ + }snd_pcm_sync_stop (substream, true);
Signature · 1 line
2.55.0