From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: Re: [PATCH] Document kfree and vfree NULL usage Date: Mon, 29 Nov 2004 15:18:09 +0100 Message-ID: References: <1101565560.9988.20.camel@localhost> <20041127171357.GA5381@penguin.localdomain> <1101583844.9988.6.camel@localhost> <20041127204317.GA21422@penguin.localdomain> <20041127212345.GA6606@linuxace.com> <1101629155.9996.9.camel@localhost> <20041128090407.GA3370@penguin.localdomain> Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from Cantor.suse.de (mail.suse.de [195.135.220.2]) by alsa.alsa-project.org (ALSA's E-mail Delivery System) with ESMTP id 85D982BA for ; Mon, 29 Nov 2004 15:18:11 +0100 (MET) In-Reply-To: <20041128090407.GA3370@penguin.localdomain> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Marcel Sebek Cc: Pekka Enberg , Phil Oester , akpm@osdl.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Sun, 28 Nov 2004 10:04:07 +0100, Marcel Sebek wrote: > > [1 ] > On Sun, Nov 28, 2004 at 10:05:55AM +0200, Pekka Enberg wrote: > > On Sat, Nov 27, 2004 at 09:43:17PM +0100, Marcel Sebek wrote: > > > > diff -urpN linux-2.6.10/sound/core/init.c linux-2.6.10-new/sound/core/init.c > > > > --- linux-2.6.10/sound/core/init.c 2004-10-23 10:55:09.000000000 +0200 > > > > +++ linux-2.6.10-new/sound/core/init.c 2004-11-27 21:21:50.000000000 +0100 > > > > @@ -665,9 +665,8 @@ int snd_card_file_remove(snd_card_t *car > > > > spin_unlock(&card->files_lock); > > > > if (card->files == NULL) > > > > wake_up(&card->shutdown_sleep); > > > > - if (mfile) { > > > > - kfree(mfile); > > > > - } else { > > > > + kfree(mfile); > > > > + if (!mfile) { > > > > snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file); > > > > return -ENOENT; > > > > } > > > > On Sat, 2004-11-27 at 13:23 -0800, Phil Oester wrote: > > > The above change seems to always trigger the ENOENT return, no? > > > > No it doesn't. kfree() does not set mfile to NULL. However, I think the > > above would be more readable if we did the kfree() _after_ the NULL > > check. Marcel, what do you think? > > > > I think yes. The change I did only added one extra kfree call for > (mfile == NULL) and didn't save the NULL check. So here's an updated > version of the patch (and hopefully the final version :). > > Signed-off-by: Marcel Sebek The new patch is missing the open brace :) Anyway, I applied your patch to ALSA tree. Thanks. Takashi ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/