diff options
author | Jesper Juhl <juhl-lkml@dif.dk> | 2005-04-19 02:39:34 +0200 |
---|---|---|
committer | Greg K-H <gregkh@suse.de> | 2005-04-19 02:39:34 +0200 |
commit | 1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f (patch) | |
tree | 0bc14ec53acf3b4c08a9995c7ea335e236435558 /drivers/usb/media | |
parent | [PATCH] usb: kfree() cleanups in drivers/usb/core/devio.c (diff) | |
download | linux-1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f.tar.xz linux-1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f.zip |
[PATCH] USB: kfree cleanup for drivers/usb/* - no need to check for NULL
Get rid of a bunch of redundant NULL pointer checks in drivers/usb/*,
there's no need to check a pointer for NULL before calling kfree() on it.
Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Index: gregkh-2.6/drivers/usb/class/audio.c
===================================================================
Diffstat (limited to 'drivers/usb/media')
-rw-r--r-- | drivers/usb/media/dabusb.c | 3 | ||||
-rw-r--r-- | drivers/usb/media/ov511.c | 12 | ||||
-rw-r--r-- | drivers/usb/media/se401.c | 15 | ||||
-rw-r--r-- | drivers/usb/media/usbvideo.c | 6 | ||||
-rw-r--r-- | drivers/usb/media/w9968cf.c | 6 |
5 files changed, 17 insertions, 25 deletions
diff --git a/drivers/usb/media/dabusb.c b/drivers/usb/media/dabusb.c index 8823297d2191..6ca2fae99d2d 100644 --- a/drivers/usb/media/dabusb.c +++ b/drivers/usb/media/dabusb.c @@ -138,8 +138,7 @@ static int dabusb_free_queue (struct list_head *q) #ifdef DEBUG dump_urb(b->purb); #endif - if (b->purb->transfer_buffer) - kfree (b->purb->transfer_buffer); + kfree(b->purb->transfer_buffer); usb_free_urb(b->purb); tmp = p->next; list_del (p); diff --git a/drivers/usb/media/ov511.c b/drivers/usb/media/ov511.c index 0fd7ffed3a98..d6051822416e 100644 --- a/drivers/usb/media/ov511.c +++ b/drivers/usb/media/ov511.c @@ -3915,10 +3915,8 @@ ov51x_do_dealloc(struct usb_ov511 *ov) ov->tempfbuf = NULL; for (i = 0; i < OV511_NUMSBUF; i++) { - if (ov->sbuf[i].data) { - kfree(ov->sbuf[i].data); - ov->sbuf[i].data = NULL; - } + kfree(ov->sbuf[i].data); + ov->sbuf[i].data = NULL; } for (i = 0; i < OV511_NUMFRAMES; i++) { @@ -5954,10 +5952,8 @@ error: up(&ov->cbuf_lock); } - if (ov) { - kfree(ov); - ov = NULL; - } + kfree(ov); + ov = NULL; error_out: err("Camera initialization failed"); diff --git a/drivers/usb/media/se401.c b/drivers/usb/media/se401.c index 685bdae5cb62..f69e443cd1bc 100644 --- a/drivers/usb/media/se401.c +++ b/drivers/usb/media/se401.c @@ -868,13 +868,14 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401) se401->dev = NULL; - for (i=0; i<SE401_NUMSBUF; i++) if (se401->urb[i]) { - usb_kill_urb(se401->urb[i]); - usb_free_urb(se401->urb[i]); - se401->urb[i] = NULL; - kfree(se401->sbuf[i].data); - } - for (i=0; i<SE401_NUMSCRATCH; i++) if (se401->scratch[i].data) { + for (i=0; i<SE401_NUMSBUF; i++) + if (se401->urb[i]) { + usb_kill_urb(se401->urb[i]); + usb_free_urb(se401->urb[i]); + se401->urb[i] = NULL; + kfree(se401->sbuf[i].data); + } + for (i=0; i<SE401_NUMSCRATCH; i++) { kfree(se401->scratch[i].data); } if (se401->inturb) { diff --git a/drivers/usb/media/usbvideo.c b/drivers/usb/media/usbvideo.c index 298484aa27d2..24efb21969c6 100644 --- a/drivers/usb/media/usbvideo.c +++ b/drivers/usb/media/usbvideo.c @@ -1169,10 +1169,8 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) } RingQueue_Free(&uvd->dp); for (i=0; i < USBVIDEO_NUMSBUF; i++) { - if (uvd->sbuf[i].data != NULL) { - kfree (uvd->sbuf[i].data); - uvd->sbuf[i].data = NULL; - } + kfree(uvd->sbuf[i].data); + uvd->sbuf[i].data = NULL; } } } diff --git a/drivers/usb/media/w9968cf.c b/drivers/usb/media/w9968cf.c index 689e79e4bcee..ca9f3a30634f 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/usb/media/w9968cf.c @@ -3624,10 +3624,8 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) return 0; fail: /* Free unused memory */ - if (cam->control_buffer) - kfree(cam->control_buffer); - if (cam->data_buffer) - kfree(cam->data_buffer); + kfree(cam->control_buffer); + kfree(cam->data_buffer); if (cam->v4ldev) video_device_release(cam->v4ldev); up(&cam->dev_sem); |