From de1b8b93a0ba016b07d13086a15ad692536e6995 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 8 Nov 2006 15:41:29 +0100 Subject: [ALSA] Fix hang-up at disconnection of usb-audio Fix hang-up at disconnection of usb-audio devices while accessing PCM. Don't handle PCM operations any more after shutdown flag is set. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/core/pcm_native.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sound/core/pcm_native.c') diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 37b4b10850ae..66e24b5da469 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -1310,7 +1310,8 @@ static int snd_pcm_pre_prepare(struct snd_pcm_substream *substream, int f_flags) { struct snd_pcm_runtime *runtime = substream->runtime; - if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + if (runtime->status->state == SNDRV_PCM_STATE_OPEN || + runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) return -EBADFD; if (snd_pcm_running(substream)) return -EBUSY; @@ -1568,7 +1569,8 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) runtime = substream->runtime; card = substream->pcm->card; - if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + if (runtime->status->state == SNDRV_PCM_STATE_OPEN || + runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) return -EBADFD; snd_power_lock(card); -- cgit v1.2.3