]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ALSA: x86: Stop the stream when buffer is processed after disconnection
authorTakashi Iwai <tiwai@suse.de>
Wed, 15 Feb 2017 21:05:34 +0000 (22:05 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 16 Feb 2017 08:22:43 +0000 (09:22 +0100)
This shouldn't happen, but just to be sure...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/x86/intel_hdmi_audio.c

index 8d365718c692c7bbebd64961c6ffeb9c1df6d1ae..8d67031e8429522c187523f3ef36f8ee0b645b10 100644 (file)
@@ -971,19 +971,22 @@ static void had_process_buffer_done(struct snd_intelhad *intelhaddata)
 {
        struct snd_pcm_substream *substream;
 
-       if (!intelhaddata->connected)
-               return; /* disconnected? - bail out */
-
        substream = had_substream_get(intelhaddata);
        if (!substream)
                return; /* no stream? - bail out */
 
+       if (!intelhaddata->connected) {
+               snd_pcm_stop_xrun(substream);
+               goto out; /* disconnected? - bail out */
+       }
+
        /* process or stop the stream */
        if (had_process_ringbuf(substream, intelhaddata) < 0)
                snd_pcm_stop_xrun(substream);
        else
                snd_pcm_period_elapsed(substream);
 
+ out:
        had_substream_put(intelhaddata);
 }