From: Takashi Iwai Date: Tue, 29 Sep 2015 10:57:42 +0000 (+0200) Subject: ALSA: pcm: Avoid double hw_free calls at releasing a stream X-Git-Tag: KARO-TX6UL-2015-11-03~80^2~93 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=094435d41df823dde850e193add57534a5b709c9;p=karo-tx-linux.git 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: Vinod Koul Tested-by: Jeeja Kp Signed-off-by: Takashi Iwai --- diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 4863af5e7b26..139887011ba2 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -2227,7 +2227,8 @@ void snd_pcm_release_substream(struct snd_pcm_substream *substream) snd_pcm_drop(substream); 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->close(substream); substream->hw_opened = 0;