summaryrefslogtreecommitdiffstats
path: root/drivers/usb/media
diff options
context:
space:
mode:
authorJesper Juhl <juhl-lkml@dif.dk>2005-04-18 17:39:34 -0700
committerGreg K-H <gregkh@suse.de>2005-04-18 17:39:34 -0700
commit1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f (patch)
tree0bc14ec53acf3b4c08a9995c7ea335e236435558 /drivers/usb/media
parent6fd19f4b55f7fd1c9d8650bd7f8df2c81b69c5ca (diff)
downloadop-kernel-dev-1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f.zip
op-kernel-dev-1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f.tar.gz
[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.c3
-rw-r--r--drivers/usb/media/ov511.c12
-rw-r--r--drivers/usb/media/se401.c15
-rw-r--r--drivers/usb/media/usbvideo.c6
-rw-r--r--drivers/usb/media/w9968cf.c6
5 files changed, 17 insertions, 25 deletions
diff --git a/drivers/usb/media/dabusb.c b/drivers/usb/media/dabusb.c
index 8823297..6ca2fae 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 0fd7ffe..d605182 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 685bdae..f69e443 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 298484a..24efb21 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 689e79e..ca9f3a3 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);
OpenPOWER on IntegriCloud