Commit 094435d4 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: pcm: Avoid double hw_free calls at releasing a stream

snd_pcm_release_substream() always calls hw_free op when the stream
was opened.  This is superfluous in most cases because it's been
already released via explicit hw_free ioctl.  Although this double
call is usually OK as this callback should be written to be called
multiple times, it's better to avoid superfluous calls.
Reported-by: default avatarVinod Koul <vinod.koul@intel.com>
Tested-by: default avatarJeeja Kp <jeeja.kp@intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d8dfacf8
...@@ -2227,7 +2227,8 @@ void snd_pcm_release_substream(struct snd_pcm_substream *substream) ...@@ -2227,7 +2227,8 @@ void snd_pcm_release_substream(struct snd_pcm_substream *substream)
snd_pcm_drop(substream); snd_pcm_drop(substream);
if (substream->hw_opened) { if (substream->hw_opened) {
if (substream->ops->hw_free != NULL) if (substream->ops->hw_free &&
substream->runtime->status->state != SNDRV_PCM_STATE_OPEN)
substream->ops->hw_free(substream); substream->ops->hw_free(substream);
substream->ops->close(substream); substream->ops->close(substream);
substream->hw_opened = 0; substream->hw_opened = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment