The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Figo.zhang" <figo1802@gmail.com>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: 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: [PATCH] no need for checking it
Date: Sat, 06 Jun 2009 18:51:11 +0800	[thread overview]
Message-ID: <1244285472.3185.36.camel@myhost> (raw)

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;
+		
 		if (async->prealloc_buf == NULL) {
 			/* Some allocation failed above. */
 			if (async->buf_page_list) {



             reply	other threads:[~2009-06-06 10:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-06 10:51 Figo.zhang [this message]
2009-06-06 10:56 ` [PATCH] no need for checking it Pekka Enberg
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=1244285472.3185.36.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 \
    /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