aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2015-06-29 12:10:22 -0400
committerTakashi Iwai <tiwai@suse.de>2015-06-29 13:08:31 -0400
commit0755e74b8f04d17cea09fa342a788025b2b50e2e (patch)
treeedb8d032ea6c474cbb78860bb3937f7b57244df2 /sound
parent1947a114bff140b35bbad1c84a5af216f8416281 (diff)
ALSA: Fix uninintialized error return
Static analysis with cppcheck found the following error: [sound/core/init.c:118]: (error) Uninitialized variable: err ..this was introduced by commit 2471b6c80a70e80de69f5ff4c37187c3912e5874 ("ALSA: info: Register proc entries recursively, too") where the call to snd_info_card_register was removed and no longer setting the error return in err. When snd_info_create_card_entry fails to allocate a an entry, the error path exits with garbage in err. Fix is to return -ENOMEM if entry fails to be allocated. Fixes: 2471b6c80a ("ALSA: info: Register proc entries recursively, too") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/init.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index 3e0cebacefe1..20f37fb3800e 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -109,13 +109,12 @@ static void snd_card_id_read(struct snd_info_entry *entry,
109 109
110static int init_info_for_card(struct snd_card *card) 110static int init_info_for_card(struct snd_card *card)
111{ 111{
112 int err;
113 struct snd_info_entry *entry; 112 struct snd_info_entry *entry;
114 113
115 entry = snd_info_create_card_entry(card, "id", card->proc_root); 114 entry = snd_info_create_card_entry(card, "id", card->proc_root);
116 if (!entry) { 115 if (!entry) {
117 dev_dbg(card->dev, "unable to create card entry\n"); 116 dev_dbg(card->dev, "unable to create card entry\n");
118 return err; 117 return -ENOMEM;
119 } 118 }
120 entry->c.text.read = snd_card_id_read; 119 entry->c.text.read = snd_card_id_read;
121 card->proc_id = entry; 120 card->proc_id = entry;