The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: "Figo.zhang" <figo1802@gmail.com>
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, 6 Jun 2009 13:56:07 +0300	[thread overview]
Message-ID: <84144f020906060356v20cb0f8bk83e702de751f9f5e@mail.gmail.com> (raw)
In-Reply-To: <1244285472.3185.36.camel@myhost>

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/
>

  reply	other threads:[~2009-06-06 10:56 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 [this message]
2009-06-06 11:08   ` Figo.zhang
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=84144f020906060356v20cb0f8bk83e702de751f9f5e@mail.gmail.com \
    --to=penberg@cs.helsinki.fi \
    --cc=abbotti@mev.co.uk \
    --cc=ds@schleef.org \
    --cc=figo1802@gmail.com \
    --cc=fmhess@users.sourceforge.net \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.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