diff options
author | Ilia Mirkin <imirkin@alum.mit.edu> | 2011-03-13 00:28:57 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-03-14 11:57:31 -0700 |
commit | e4e1f289be88a75dc8b63d50ade1f9a2e6168021 (patch) | |
tree | d028262fea99eefe7f209c7f643942db7b660902 /drivers | |
parent | 46d994b1f5b481c7f0a77edece270cf253db84c9 (diff) |
staging: comedi: Remove NULL check before kfree
This patch was generated by the following semantic patch:
// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/comedi/drivers/8255.c | 9 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/das16.c | 6 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/ni_at_a2150.c | 3 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/ni_labpc.c | 3 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers/serial2002.c | 8 | ||||
-rw-r--r-- | 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 95049a8d3b38..6c26ac887eee 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 0af1b4659088..e7905bac92da 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 e46d62b75fc0..4d0053ea2465 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 0728c3c0cb0e..241fe525abf0 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 c9be9e05f028..ebfce33f0b4f 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 696ee045e25f..be93c30e4b15 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]); |