Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6
[firefly-linux-kernel-4.4.55.git] / sound / core / oss / pcm_oss.c
index 472fce0ee0e8111210e68ead84424f4f477635f2..e0821eb3d8517b2f258bb0353ebe0c10418f8b73 100644 (file)
@@ -2359,7 +2359,8 @@ static int snd_pcm_oss_release(struct inode *inode, struct file *file)
                substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
        snd_assert(substream != NULL, return -ENXIO);
        pcm = substream->pcm;
-       snd_pcm_oss_sync(pcm_oss_file);
+       if (!pcm->card->shutdown)
+               snd_pcm_oss_sync(pcm_oss_file);
        mutex_lock(&pcm->open_mutex);
        snd_pcm_oss_release_file(pcm_oss_file);
        mutex_unlock(&pcm->open_mutex);
@@ -2846,11 +2847,9 @@ static void snd_pcm_oss_proc_done(struct snd_pcm *pcm)
        int stream;
        for (stream = 0; stream < 2; ++stream) {
                struct snd_pcm_str *pstr = &pcm->streams[stream];
-               if (pstr->oss.proc_entry) {
-                       snd_info_unregister(pstr->oss.proc_entry);
-                       pstr->oss.proc_entry = NULL;
-                       snd_pcm_oss_proc_free_setup_list(pstr);
-               }
+               snd_info_free_entry(pstr->oss.proc_entry);
+               pstr->oss.proc_entry = NULL;
+               snd_pcm_oss_proc_free_setup_list(pstr);
        }
 }
 #else /* !CONFIG_SND_VERBOSE_PROCFS */
@@ -2931,25 +2930,23 @@ static int snd_pcm_oss_disconnect_minor(struct snd_pcm *pcm)
                        snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM,
                                                  pcm->card, 1);
                }
-       }
-       return 0;
-}
-
-static int snd_pcm_oss_unregister_minor(struct snd_pcm *pcm)
-{
-       snd_pcm_oss_disconnect_minor(pcm);
-       if (pcm->oss.reg) {
                if (dsp_map[pcm->card->number] == (int)pcm->device) {
 #ifdef SNDRV_OSS_INFO_DEV_AUDIO
                        snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_AUDIO, pcm->card->number);
 #endif
                }
                pcm->oss.reg = 0;
-               snd_pcm_oss_proc_done(pcm);
        }
        return 0;
 }
 
+static int snd_pcm_oss_unregister_minor(struct snd_pcm *pcm)
+{
+       snd_pcm_oss_disconnect_minor(pcm);
+       snd_pcm_oss_proc_done(pcm);
+       return 0;
+}
+
 static struct snd_pcm_notify snd_pcm_oss_notify =
 {
        .n_register =   snd_pcm_oss_register_minor,