public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: sebek64@post.cz (Marcel Sebek)
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
	Phil Oester <kernel@linuxace.com>,
	akpm@osdl.org, linux-kernel@vger.kernel.org,
	alsa-devel@alsa-project.org
Subject: Re: [Alsa-devel] Re: [PATCH] Document kfree and vfree NULL usage
Date: Mon, 29 Nov 2004 15:18:09 +0100	[thread overview]
Message-ID: <s5hvfbopwm6.wl@alsa2.suse.de> (raw)
In-Reply-To: <20041128090407.GA3370@penguin.localdomain>

At Sun, 28 Nov 2004 10:04:07 +0100,
Marcel Sebek wrote:
> 
> [1  <text/plain; us-ascii (quoted-printable)>]
> 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 <sebek64@post.cz>

The new patch is missing the open brace :)

Anyway, I applied your patch to ALSA tree.  Thanks.


Takashi

  reply	other threads:[~2004-11-29 14:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-27 14:26 [PATCH] Document kfree and vfree NULL usage Pekka Enberg
2004-11-27 17:13 ` Marcel Sebek
2004-11-27 19:30   ` Pekka Enberg
2004-11-27 20:43     ` Marcel Sebek
2004-11-27 21:23       ` Phil Oester
2004-11-28  8:05         ` Pekka Enberg
2004-11-28  9:04           ` Marcel Sebek
2004-11-29 14:18             ` Takashi Iwai [this message]
2004-11-27 23:58   ` Tomas Carnecky
2004-11-28  0:17     ` Nick Piggin
2004-11-28  8:20       ` Pekka Enberg
2004-11-27 23:39 ` John Levon
2004-11-28  8:00   ` Pekka Enberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hvfbopwm6.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=akpm@osdl.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=kernel@linuxace.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=sebek64@post.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox