From b591b6e9e99017137888e2e397f0ddd8adb77c5d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 22 Apr 2015 22:29:10 +0200 Subject: 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 Signed-off-by: Takashi Iwai --- sound/core/info.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'sound/core/info.c') diff --git a/sound/core/info.c b/sound/core/info.c index 339f90a3aa29..4169062fabf5 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -482,10 +482,11 @@ int __init snd_info_init(void) if (!snd_seq_root) goto error; #endif - snd_info_version_init(); - snd_minor_info_init(); - snd_minor_info_oss_init(); - snd_card_info_init(); + if (snd_info_version_init() < 0 || + snd_minor_info_init() < 0 || + snd_minor_info_oss_init() < 0 || + snd_card_info_init() < 0) + goto error; return 0; error: @@ -847,11 +848,7 @@ static int __init snd_info_version_init(void) if (entry == NULL) return -ENOMEM; entry->c.text.read = snd_info_version_read; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - return -ENOMEM; - } - return 0; + return snd_info_register(entry); /* freed in error path */ } #endif /* CONFIG_PROC_FS */ -- cgit v1.2.3