{
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);
}