linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Jeff Garzik <jeff@garzik.org>
Cc: linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: Re: [PATCH] ext3_clear_inode(): avoid kfree(NULL)
Date: Fri, 23 Jun 2006 14:24:30 -0700	[thread overview]
Message-ID: <20060623142430.333dd666.akpm@osdl.org> (raw)
In-Reply-To: <449C3817.2030802@garzik.org>

On Fri, 23 Jun 2006 14:51:03 -0400
Jeff Garzik <jeff@garzik.org> wrote:

> Linux Kernel Mailing List wrote:
> > commit e6022603b9aa7d61d20b392e69edcdbbc1789969
> > tree f94b059e312ea7b2f3c4d0b01939e868ed525fb0
> > parent 304c4c841a31c780a45d65e389b07706babf5d36
> > author Andrew Morton <akpm@osdl.org> Fri, 23 Jun 2006 16:05:32 -0700
> > committer Linus Torvalds <torvalds@g5.osdl.org> Fri, 23 Jun 2006 21:43:05 -0700
> > 
> > [PATCH] ext3_clear_inode(): avoid kfree(NULL)
> > 
> > Steven Rostedt <rostedt@goodmis.org> points out that `rsv' here is usually
> > NULL, so we should avoid calling kfree().
> > 
> > Also, fix up some nearby whitespace damage.
> > 
> > Signed-off-by: Andrew Morton <akpm@osdl.org>
> > Signed-off-by: Linus Torvalds <torvalds@osdl.org>
> 
> Dumb question...  why?  kfree(NULL) has always been explicitly allowed.
> 

Because at that callsite, NULL is the common case.  We avoid a do-nothing
function call most of the time.  It's a nano-optimisation.

  reply	other threads:[~2006-06-23 21:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200606231502.k5NF2jfO007109@hera.kernel.org>
2006-06-23 18:51 ` [PATCH] ext3_clear_inode(): avoid kfree(NULL) Jeff Garzik
2006-06-23 21:24   ` Andrew Morton [this message]
2006-06-24 12:11     ` Arjan van de Ven
2006-06-24 12:20       ` Steven Rostedt
2006-06-24 12:27         ` Arjan van de Ven
2006-06-24 12:33           ` Steven Rostedt
2006-06-24 12:46             ` Arjan van de Ven
2006-06-24 12:51               ` Steven Rostedt
2006-06-24 12:53               ` Arjan van de Ven
2006-06-24 13:07                 ` Steven Rostedt
2006-06-24 14:11                   ` Arjan van de Ven
2006-06-24 16:06                     ` Nick Piggin
2006-06-24 16:49               ` Jeremy Fitzhardinge
2006-06-24 16:55                 ` Arjan van de Ven
2006-06-24 16:19       ` 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=20060623142430.333dd666.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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;
as well as URLs for NNTP newsgroup(s).