Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752474Ab1CMF3z (ORCPT ); Sun, 13 Mar 2011 00:29:55 -0500 Received: from mail-qy0-f174.google.com ([209.85.216.174]:59333 "EHLO mail-qy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751273Ab1CMF3b (ORCPT ); Sun, 13 Mar 2011 00:29:31 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=hzWWoboXGAL2pGFHDF0pk7WQTlBbCqZceEgiZFcZ3EpFYTOvOBo0zkHtz3yQwcqFR7 2BJImzC0sWlFHIU6peq/kNp/qIVDG8fm6KKpOfUQjlAMll1zCpWzenjWH9zJ/so3rINd kMXJReruf/SUQHTgKE0TPWv+wWm7WbsqLXL50= From: Ilia Mirkin To: Greg Kroah-Hartman Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/24] staging: comedi: Remove NULL check before kfree Date: Sun, 13 Mar 2011 00:28:57 -0500 Message-Id: <1299994157-11191-5-git-send-email-imirkin@alum.mit.edu> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1299994157-11191-4-git-send-email-imirkin@alum.mit.edu> References: <20110222145452.GD1331@suse.de> <1299994157-11191-1-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-2-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-3-git-send-email-imirkin@alum.mit.edu> <1299994157-11191-4-git-send-email-imirkin@alum.mit.edu> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4626 Lines: 133 This patch was generated by the following semantic patch: // @@ expression E; @@ - if (E != NULL) { kfree(E); } + kfree(E); @@ expression E; @@ - if (E != NULL) { kfree(E); E = NULL; } + kfree(E); + E = NULL; // Signed-off-by: Ilia Mirkin --- drivers/staging/comedi/drivers/8255.c | 9 +-------- drivers/staging/comedi/drivers/das16.c | 6 ++---- drivers/staging/comedi/drivers/ni_at_a2150.c | 3 +-- drivers/staging/comedi/drivers/ni_labpc.c | 3 +-- drivers/staging/comedi/drivers/serial2002.c | 8 ++------ drivers/staging/comedi/drivers/usbdux.c | 8 ++------ 6 files changed, 9 insertions(+), 28 deletions(-) diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 95049a8..6c26ac8 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -383,14 +383,7 @@ EXPORT_SYMBOL(subdev_8255_init_irq); void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice *s) { - if (s->private) { - /* this test does nothing, so comment it out - * if (subdevpriv->have_irq) { - * } - */ - - kfree(s->private); - } + kfree(s->private); } EXPORT_SYMBOL(subdev_8255_cleanup); diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index 0af1b46..e7905ba 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -1695,10 +1695,8 @@ static int das16_detach(struct comedi_device *dev) } if (devpriv->dma_chan) free_dma(devpriv->dma_chan); - if (devpriv->user_ai_range_table) - kfree(devpriv->user_ai_range_table); - if (devpriv->user_ao_range_table) - kfree(devpriv->user_ao_range_table); + kfree(devpriv->user_ai_range_table); + kfree(devpriv->user_ao_range_table); } if (dev->irq) diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c index e46d62b..4d0053e 100644 --- a/drivers/staging/comedi/drivers/ni_at_a2150.c +++ b/drivers/staging/comedi/drivers/ni_at_a2150.c @@ -479,8 +479,7 @@ static int a2150_detach(struct comedi_device *dev) if (devpriv) { if (devpriv->dma) free_dma(devpriv->dma); - if (devpriv->dma_buffer) - kfree(devpriv->dma_buffer); + kfree(devpriv->dma_buffer); } return 0; diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 0728c3c..241fe52 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -797,8 +797,7 @@ int labpc_common_detach(struct comedi_device *dev) subdev_8255_cleanup(dev, dev->subdevices + 2); /* only free stuff if it has been allocated by _attach */ - if (devpriv->dma_buffer) - kfree(devpriv->dma_buffer); + kfree(devpriv->dma_buffer); if (devpriv->dma_chan) free_dma(devpriv->dma_chan); if (dev->irq) diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c index c9be9e0..ebfce33 100644 --- a/drivers/staging/comedi/drivers/serial2002.c +++ b/drivers/staging/comedi/drivers/serial2002.c @@ -907,12 +907,8 @@ static int serial2002_detach(struct comedi_device *dev) printk("comedi%d: serial2002: remove\n", dev->minor); for (i = 0; i < 5; i++) { s = &dev->subdevices[i]; - if (s->maxdata_list) { - kfree(s->maxdata_list); - } - if (s->range_table_list) { - kfree(s->range_table_list); - } + kfree(s->maxdata_list); + kfree(s->range_table_list); } return 0; } diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 696ee04..be93c30 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -2265,12 +2265,8 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp) usbduxsub_unlink_OutURBs(usbduxsub_tmp); } for (i = 0; i < usbduxsub_tmp->numOfOutBuffers; i++) { - if (usbduxsub_tmp->urbOut[i]->transfer_buffer) { - kfree(usbduxsub_tmp-> - urbOut[i]->transfer_buffer); - usbduxsub_tmp->urbOut[i]->transfer_buffer = - NULL; - } + kfree(usbduxsub_tmp->urbOut[i]->transfer_buffer); + usbduxsub_tmp->urbOut[i]->transfer_buffer = NULL; if (usbduxsub_tmp->urbOut[i]) { usb_kill_urb(usbduxsub_tmp->urbOut[i]); usb_free_urb(usbduxsub_tmp->urbOut[i]); -- 1.7.3.4 -- 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/