aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-09-29 06:57:42 -0400
committerTakashi Iwai <tiwai@suse.de>2015-09-29 06:57:42 -0400
commit094435d41df823dde850e193add57534a5b709c9 (patch)
tree3689474c22c3a771007a2f3095d622affe36dfcc
parentd8dfacf8b50c260d79864933ac82a8198a0908a9 (diff)
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 <vinod.koul@intel.com> Tested-by: Jeeja Kp <jeeja.kp@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/core/pcm_native.c3
1 files changed, 2 insertions, 1 deletions
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)
2227 2227
2228 snd_pcm_drop(substream); 2228 snd_pcm_drop(substream);
2229 if (substream->hw_opened) { 2229 if (substream->hw_opened) {
2230 if (substream->ops->hw_free != NULL) 2230 if (substream->ops->hw_free &&
2231 substream->runtime->status->state != SNDRV_PCM_STATE_OPEN)
2231 substream->ops->hw_free(substream); 2232 substream->ops->hw_free(substream);
2232 substream->ops->close(substream); 2233 substream->ops->close(substream);
2233 substream->hw_opened = 0; 2234 substream->hw_opened = 0;