diff options
author | Jesper Juhl <juhl-lkml@dif.dk> | 2005-04-18 20:39:34 -0400 |
---|---|---|
committer | Greg K-H <gregkh@suse.de> | 2005-04-18 20:39:34 -0400 |
commit | 1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f (patch) | |
tree | 0bc14ec53acf3b4c08a9995c7ea335e236435558 /drivers/usb/media | |
parent | 6fd19f4b55f7fd1c9d8650bd7f8df2c81b69c5ca (diff) |
[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) | |||
138 | #ifdef DEBUG | 138 | #ifdef DEBUG |
139 | dump_urb(b->purb); | 139 | dump_urb(b->purb); |
140 | #endif | 140 | #endif |
141 | if (b->purb->transfer_buffer) | 141 | kfree(b->purb->transfer_buffer); |
142 | kfree (b->purb->transfer_buffer); | ||
143 | usb_free_urb(b->purb); | 142 | usb_free_urb(b->purb); |
144 | tmp = p->next; | 143 | tmp = p->next; |
145 | list_del (p); | 144 | 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) | |||
3915 | ov->tempfbuf = NULL; | 3915 | ov->tempfbuf = NULL; |
3916 | 3916 | ||
3917 | for (i = 0; i < OV511_NUMSBUF; i++) { | 3917 | for (i = 0; i < OV511_NUMSBUF; i++) { |
3918 | if (ov->sbuf[i].data) { | 3918 | kfree(ov->sbuf[i].data); |
3919 | kfree(ov->sbuf[i].data); | 3919 | ov->sbuf[i].data = NULL; |
3920 | ov->sbuf[i].data = NULL; | ||
3921 | } | ||
3922 | } | 3920 | } |
3923 | 3921 | ||
3924 | for (i = 0; i < OV511_NUMFRAMES; i++) { | 3922 | for (i = 0; i < OV511_NUMFRAMES; i++) { |
@@ -5954,10 +5952,8 @@ error: | |||
5954 | up(&ov->cbuf_lock); | 5952 | up(&ov->cbuf_lock); |
5955 | } | 5953 | } |
5956 | 5954 | ||
5957 | if (ov) { | 5955 | kfree(ov); |
5958 | kfree(ov); | 5956 | ov = NULL; |
5959 | ov = NULL; | ||
5960 | } | ||
5961 | 5957 | ||
5962 | error_out: | 5958 | error_out: |
5963 | err("Camera initialization failed"); | 5959 | 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) | |||
868 | 868 | ||
869 | se401->dev = NULL; | 869 | se401->dev = NULL; |
870 | 870 | ||
871 | for (i=0; i<SE401_NUMSBUF; i++) if (se401->urb[i]) { | 871 | for (i=0; i<SE401_NUMSBUF; i++) |
872 | usb_kill_urb(se401->urb[i]); | 872 | if (se401->urb[i]) { |
873 | usb_free_urb(se401->urb[i]); | 873 | usb_kill_urb(se401->urb[i]); |
874 | se401->urb[i] = NULL; | 874 | usb_free_urb(se401->urb[i]); |
875 | kfree(se401->sbuf[i].data); | 875 | se401->urb[i] = NULL; |
876 | } | 876 | kfree(se401->sbuf[i].data); |
877 | for (i=0; i<SE401_NUMSCRATCH; i++) if (se401->scratch[i].data) { | 877 | } |
878 | for (i=0; i<SE401_NUMSCRATCH; i++) { | ||
878 | kfree(se401->scratch[i].data); | 879 | kfree(se401->scratch[i].data); |
879 | } | 880 | } |
880 | if (se401->inturb) { | 881 | 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) | |||
1169 | } | 1169 | } |
1170 | RingQueue_Free(&uvd->dp); | 1170 | RingQueue_Free(&uvd->dp); |
1171 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { | 1171 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { |
1172 | if (uvd->sbuf[i].data != NULL) { | 1172 | kfree(uvd->sbuf[i].data); |
1173 | kfree (uvd->sbuf[i].data); | 1173 | uvd->sbuf[i].data = NULL; |
1174 | uvd->sbuf[i].data = NULL; | ||
1175 | } | ||
1176 | } | 1174 | } |
1177 | } | 1175 | } |
1178 | } | 1176 | } |
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) | |||
3624 | return 0; | 3624 | return 0; |
3625 | 3625 | ||
3626 | fail: /* Free unused memory */ | 3626 | fail: /* Free unused memory */ |
3627 | if (cam->control_buffer) | 3627 | kfree(cam->control_buffer); |
3628 | kfree(cam->control_buffer); | 3628 | kfree(cam->data_buffer); |
3629 | if (cam->data_buffer) | ||
3630 | kfree(cam->data_buffer); | ||
3631 | if (cam->v4ldev) | 3629 | if (cam->v4ldev) |
3632 | video_device_release(cam->v4ldev); | 3630 | video_device_release(cam->v4ldev); |
3633 | up(&cam->dev_sem); | 3631 | up(&cam->dev_sem); |