From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753114AbbF2RK6 (ORCPT ); Mon, 29 Jun 2015 13:10:58 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42849 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752369AbbF2RKq (ORCPT ); Mon, 29 Jun 2015 13:10:46 -0400 Date: Mon, 29 Jun 2015 19:10:44 +0200 Message-ID: From: Takashi Iwai To: Colin King Cc: Jaroslav Kysela , Mark Brown , Jie Yang , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: Fix uninintialized error return In-Reply-To: <1435594222-17690-1-git-send-email-colin.king@canonical.com> References: <1435594222-17690-1-git-send-email-colin.king@canonical.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Mon, 29 Jun 2015 17:10:22 +0100, Colin King wrote: > > From: Colin Ian King > > 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. > > Author: Takashi Iwai > Date: Mon May 18 09:20:24 2015 +0200 These two lines seem superfluous. I removed them and applied the patch now. Thanks. Takashi > > Fixes: 2471b6c80a ("ALSA: info: Register proc entries recursively, too") > Signed-off-by: Colin Ian King > --- > sound/core/init.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sound/core/init.c b/sound/core/init.c > index 3e0ceba..20f37fb 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, > > static int init_info_for_card(struct snd_card *card) > { > - int err; > struct snd_info_entry *entry; > > entry = snd_info_create_card_entry(card, "id", card->proc_root); > if (!entry) { > dev_dbg(card->dev, "unable to create card entry\n"); > - return err; > + return -ENOMEM; > } > entry->c.text.read = snd_card_id_read; > card->proc_id = entry; > -- > 2.1.4 >