summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-02-15 22:05:34 +0100
committerTakashi Iwai <tiwai@suse.de>2017-02-16 09:22:43 +0100
commitbe9a2e933e301bec856d526516801e14247519c5 (patch)
treedd479337bf8ddbac9849478748dd4f899cadd054
parent28ed125b9a07b9ad09ea680628a920427d079af6 (diff)
ALSA: x86: Stop the stream when buffer is processed after disconnection
This shouldn't happen, but just to be sure... Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/x86/intel_hdmi_audio.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c
index 8d365718c692..8d67031e8429 100644
--- a/sound/x86/intel_hdmi_audio.c
+++ b/sound/x86/intel_hdmi_audio.c
@@ -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);
}