From 1576274d30286dd048967176dc8e75e192051ff5 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 6 Apr 2006 19:47:42 +0200 Subject: [ALSA] Fix Oops of PCM OSS emulation Modules: PCM Midlevel,ALSA<-OSS emulation Fix Oops of PCM OSS emulation occuring when multiple playback is used. Signed-off-by: Takashi Iwai --- sound/core/oss/pcm_oss.c | 5 +++-- sound/core/pcm_native.c | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'sound/core') diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 7c0c4e1d6943..c5978d6c6080 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -1682,7 +1682,7 @@ static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream, substream->oss.setup = *setup; if (setup->nonblock) substream->ffile->f_flags |= O_NONBLOCK; - else + else if (setup->block) substream->ffile->f_flags &= ~O_NONBLOCK; runtime = substream->runtime; runtime->oss.params = 1; @@ -1757,6 +1757,7 @@ static int snd_pcm_oss_open_file(struct file *file, } pcm_oss_file->streams[idx] = substream; + substream->file = pcm_oss_file; snd_pcm_oss_init_substream(substream, &setup[idx], minor); } @@ -1809,7 +1810,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) err = -EFAULT; goto __error; } - memset(setup, 0, sizeof(*setup)); + memset(setup, 0, sizeof(setup)); if (file->f_mode & FMODE_WRITE) snd_pcm_oss_look_for_setup(pcm, SNDRV_PCM_STREAM_PLAYBACK, task_name, &setup[0]); diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 964e4c47a7f1..0860c5a84502 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -2007,14 +2007,16 @@ static void pcm_release_private(struct snd_pcm_substream *substream) void snd_pcm_release_substream(struct snd_pcm_substream *substream) { snd_pcm_drop(substream); - if (substream->pcm_release) - substream->pcm_release(substream); if (substream->hw_opened) { if (substream->ops->hw_free != NULL) substream->ops->hw_free(substream); substream->ops->close(substream); substream->hw_opened = 0; } + if (substream->pcm_release) { + substream->pcm_release(substream); + substream->pcm_release = NULL; + } snd_pcm_detach_substream(substream); } -- cgit v1.2.3-59-g8ed1b