All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Figo.zhang" <figo1802@gmail.com>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	Ian Abbott <abbotti@mev.co.uk>,
	Frank Mori Hess <fmhess@users.sourceforge.net>,
	David Schleef <ds@schleef.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] no need for checking it
Date: Sat, 06 Jun 2009 19:08:19 +0800	[thread overview]
Message-ID: <1244286499.3185.39.camel@myhost> (raw)
In-Reply-To: <84144f020906060356v20cb0f8bk83e702de751f9f5e@mail.gmail.com>

On Sat, 2009-06-06 at 13:56 +0300, Pekka Enberg wrote:
> On Sat, Jun 6, 2009 at 1:51 PM, Figo.zhang <figo1802@gmail.com> wrote:
> > vfree() does it's own NULL checking,so no need for check before
> > calling it.
> >
> > Signed-off-by: Figo.zhang <figo1802@gmail.com>
> > ---
> >  drivers/staging/comedi/drivers.c |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/comedi/drivers.c
> > b/drivers/staging/comedi/drivers.c
> > index 6e13e45..ce50e85 100644
> > --- a/drivers/staging/comedi/drivers.c
> > +++ b/drivers/staging/comedi/drivers.c
> > @@ -495,9 +495,9 @@ int comedi_buf_alloc(struct comedi_device *dev,
> > struct comedi_subdevice *s,
> >                                vmap(pages, n_pages, VM_MAP,
> >                                PAGE_KERNEL_NOCACHE);
> >                }
> > -               if (pages) {
> > -                       vfree(pages);
> > -               }
> > +               vfree(pages);
> > +               pages = NULL;
> 
> Why the assignment to NULL? It looks redundant to me.
> 
> > +
> >                if (async->prealloc_buf == NULL) {
> >                        /* Some allocation failed above. */
> >                        if (async->buf_page_list) {
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> >

yes, 'pages' is local variable argment,it is no need assignment to NULL.

Best Regards,

Figo.zhang


  reply	other threads:[~2009-06-06 11:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-06 10:51 [PATCH] no need for checking it Figo.zhang
2009-06-06 10:56 ` Pekka Enberg
2009-06-06 11:08   ` Figo.zhang [this message]
2009-06-06 11:11 ` [PATCH V2] " Figo.zhang
2009-06-06 11:29   ` 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=1244286499.3185.39.camel@myhost \
    --to=figo1802@gmail.com \
    --cc=abbotti@mev.co.uk \
    --cc=ds@schleef.org \
    --cc=fmhess@users.sourceforge.net \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.