summaryrefslogtreecommitdiff
path: root/sound/core/pcm_memory.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-01-23 16:44:38 +0100
committerTakashi Iwai <tiwai@suse.de>2019-01-24 14:40:25 +0100
commit480e32ebd524ffdf3d50cc5cac179fb9e44a552d (patch)
tree7f9030fe1751a73ab636c567305f1a6e848b3e36 /sound/core/pcm_memory.c
parentde89750c56f4bf2f04492c6ce298911381a7597a (diff)
ALSA: pcm: Simplify proc file destruction
The proc files are recursively freed by calling with the root snd_info_entry object, so we don't have to keep each object for releasing one by one. Move the release of the PCM stream proc root at the beginning, so that we can remove the redundant code and resource. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_memory.c')
-rw-r--r--sound/core/pcm_memory.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index 4b5356a10315..9a98bc61461f 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -93,12 +93,6 @@ static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream
int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream)
{
snd_pcm_lib_preallocate_dma_free(substream);
-#ifdef CONFIG_SND_VERBOSE_PROCFS
- snd_info_free_entry(substream->proc_prealloc_max_entry);
- substream->proc_prealloc_max_entry = NULL;
- snd_info_free_entry(substream->proc_prealloc_entry);
- substream->proc_prealloc_entry = NULL;
-#endif
return 0;
}
@@ -203,21 +197,15 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream)
entry->c.text.write = snd_pcm_lib_preallocate_proc_write;
entry->mode |= 0200;
entry->private_data = substream;
- if (snd_info_register(entry) < 0) {
+ if (snd_info_register(entry) < 0)
snd_info_free_entry(entry);
- entry = NULL;
- }
}
- substream->proc_prealloc_entry = entry;
if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc_max", substream->proc_root)) != NULL) {
entry->c.text.read = snd_pcm_lib_preallocate_max_proc_read;
entry->private_data = substream;
- if (snd_info_register(entry) < 0) {
+ if (snd_info_register(entry) < 0)
snd_info_free_entry(entry);
- entry = NULL;
- }
}
- substream->proc_prealloc_max_entry = entry;
}
#else /* !CONFIG_SND_VERBOSE_PROCFS */