summaryrefslogtreecommitdiff
path: root/sound/core/init.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-04-22 22:29:10 +0200
committerTakashi Iwai <tiwai@suse.de>2015-04-24 17:31:06 +0200
commitb591b6e9e99017137888e2e397f0ddd8adb77c5d (patch)
tree5ef26ea5c88a94d2f942f933ffe7bbaa7349e102 /sound/core/init.c
parentb046d244e2290e3d114af2e91503ee3d08fc605a (diff)
ALSA: core: Don't ignore errors at creating proc files
So far we've ignored the errors at creating proc files in many places. But they should be rather treated seriously. Also, by assuring the error handling, we can get rid of superfluous snd_info_free_entry() calls as they will be removed by the parent in the caller side. This patch fixes the missing error checks and reduces the superfluous free calls. Acked-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/init.c')
-rw-r--r--sound/core/init.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index 0af34fac0499..769a783757ff 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -853,18 +853,16 @@ int __init snd_card_info_init(void)
if (! entry)
return -ENOMEM;
entry->c.text.read = snd_card_info_read;
- if (snd_info_register(entry) < 0) {
- snd_info_free_entry(entry);
- return -ENOMEM;
- }
+ if (snd_info_register(entry) < 0)
+ return -ENOMEM; /* freed in error path */
#ifdef MODULE
entry = snd_info_create_module_entry(THIS_MODULE, "modules", NULL);
- if (entry) {
- entry->c.text.read = snd_card_module_info_read;
- if (snd_info_register(entry) < 0)
- snd_info_free_entry(entry);
- }
+ if (!entry)
+ return -ENOMEM;
+ entry->c.text.read = snd_card_module_info_read;
+ if (snd_info_register(entry) < 0)
+ return -ENOMEM; /* freed in error path */
#endif
return 0;