aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/class/audio.c48
-rw-r--r--drivers/usb/class/bluetty.c4
-rw-r--r--drivers/usb/core/devices.c7
-rw-r--r--drivers/usb/core/hub.c16
-rw-r--r--drivers/usb/gadget/serial.c5
-rw-r--r--drivers/usb/host/ehci-mem.c3
-rw-r--r--drivers/usb/host/uhci-hcd.c7
-rw-r--r--drivers/usb/input/hid-core.c3
-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
-rw-r--r--drivers/usb/misc/auerswald.c26
-rw-r--r--drivers/usb/net/zd1201.c3
-rw-r--r--drivers/usb/serial/belkin_sa.c3
-rw-r--r--drivers/usb/serial/cypress_m8.c5
-rw-r--r--drivers/usb/serial/empeg.c6
-rw-r--r--drivers/usb/serial/ftdi_sio.c10
-rw-r--r--drivers/usb/serial/io_edgeport.c24
-rw-r--r--drivers/usb/serial/io_ti.c5
-rw-r--r--drivers/usb/serial/kl5kusb105.c3
-rw-r--r--drivers/usb/serial/omninet.c5
-rw-r--r--drivers/usb/serial/pl2303.c5
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c3
-rw-r--r--drivers/usb/storage/sddr55.c24
26 files changed, 91 insertions, 166 deletions
diff --git a/drivers/usb/class/audio.c b/drivers/usb/class/audio.c
index f432b7d5b235..f8f21567cc22 100644
--- a/drivers/usb/class/audio.c
+++ b/drivers/usb/class/audio.c
@@ -649,14 +649,10 @@ static void usbin_stop(struct usb_audiodev *as)
649 } 649 }
650 } 650 }
651 set_current_state(TASK_RUNNING); 651 set_current_state(TASK_RUNNING);
652 if (u->durb[0].urb->transfer_buffer) 652 kfree(u->durb[0].urb->transfer_buffer);
653 kfree(u->durb[0].urb->transfer_buffer); 653 kfree(u->durb[1].urb->transfer_buffer);
654 if (u->durb[1].urb->transfer_buffer) 654 kfree(u->surb[0].urb->transfer_buffer);
655 kfree(u->durb[1].urb->transfer_buffer); 655 kfree(u->surb[1].urb->transfer_buffer);
656 if (u->surb[0].urb->transfer_buffer)
657 kfree(u->surb[0].urb->transfer_buffer);
658 if (u->surb[1].urb->transfer_buffer)
659 kfree(u->surb[1].urb->transfer_buffer);
660 u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer = 656 u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer =
661 u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL; 657 u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL;
662} 658}
@@ -1009,21 +1005,17 @@ static int usbin_start(struct usb_audiodev *as)
1009 u->phase = 0; 1005 u->phase = 0;
1010 maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format)); 1006 maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format));
1011 bufsz = DESCFRAMES * maxsze; 1007 bufsz = DESCFRAMES * maxsze;
1012 if (u->durb[0].urb->transfer_buffer) 1008 kfree(u->durb[0].urb->transfer_buffer);
1013 kfree(u->durb[0].urb->transfer_buffer);
1014 u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); 1009 u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
1015 u->durb[0].urb->transfer_buffer_length = bufsz; 1010 u->durb[0].urb->transfer_buffer_length = bufsz;
1016 if (u->durb[1].urb->transfer_buffer) 1011 kfree(u->durb[1].urb->transfer_buffer);
1017 kfree(u->durb[1].urb->transfer_buffer);
1018 u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); 1012 u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
1019 u->durb[1].urb->transfer_buffer_length = bufsz; 1013 u->durb[1].urb->transfer_buffer_length = bufsz;
1020 if (u->syncpipe) { 1014 if (u->syncpipe) {
1021 if (u->surb[0].urb->transfer_buffer) 1015 kfree(u->surb[0].urb->transfer_buffer);
1022 kfree(u->surb[0].urb->transfer_buffer);
1023 u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); 1016 u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
1024 u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES; 1017 u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES;
1025 if (u->surb[1].urb->transfer_buffer) 1018 kfree(u->surb[1].urb->transfer_buffer);
1026 kfree(u->surb[1].urb->transfer_buffer);
1027 u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); 1019 u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
1028 u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES; 1020 u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES;
1029 } 1021 }
@@ -1128,14 +1120,10 @@ static void usbout_stop(struct usb_audiodev *as)
1128 } 1120 }
1129 } 1121 }
1130 set_current_state(TASK_RUNNING); 1122 set_current_state(TASK_RUNNING);
1131 if (u->durb[0].urb->transfer_buffer) 1123 kfree(u->durb[0].urb->transfer_buffer);
1132 kfree(u->durb[0].urb->transfer_buffer); 1124 kfree(u->durb[1].urb->transfer_buffer);
1133 if (u->durb[1].urb->transfer_buffer) 1125 kfree(u->surb[0].urb->transfer_buffer);
1134 kfree(u->durb[1].urb->transfer_buffer); 1126 kfree(u->surb[1].urb->transfer_buffer);
1135 if (u->surb[0].urb->transfer_buffer)
1136 kfree(u->surb[0].urb->transfer_buffer);
1137 if (u->surb[1].urb->transfer_buffer)
1138 kfree(u->surb[1].urb->transfer_buffer);
1139 u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer = 1127 u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer =
1140 u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL; 1128 u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL;
1141} 1129}
@@ -1376,21 +1364,17 @@ static int usbout_start(struct usb_audiodev *as)
1376 u->phase = 0; 1364 u->phase = 0;
1377 maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format)); 1365 maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format));
1378 bufsz = DESCFRAMES * maxsze; 1366 bufsz = DESCFRAMES * maxsze;
1379 if (u->durb[0].urb->transfer_buffer) 1367 kfree(u->durb[0].urb->transfer_buffer);
1380 kfree(u->durb[0].urb->transfer_buffer);
1381 u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); 1368 u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
1382 u->durb[0].urb->transfer_buffer_length = bufsz; 1369 u->durb[0].urb->transfer_buffer_length = bufsz;
1383 if (u->durb[1].urb->transfer_buffer) 1370 kfree(u->durb[1].urb->transfer_buffer);
1384 kfree(u->durb[1].urb->transfer_buffer);
1385 u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); 1371 u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL);
1386 u->durb[1].urb->transfer_buffer_length = bufsz; 1372 u->durb[1].urb->transfer_buffer_length = bufsz;
1387 if (u->syncpipe) { 1373 if (u->syncpipe) {
1388 if (u->surb[0].urb->transfer_buffer) 1374 kfree(u->surb[0].urb->transfer_buffer);
1389 kfree(u->surb[0].urb->transfer_buffer);
1390 u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); 1375 u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
1391 u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES; 1376 u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES;
1392 if (u->surb[1].urb->transfer_buffer) 1377 kfree(u->surb[1].urb->transfer_buffer);
1393 kfree(u->surb[1].urb->transfer_buffer);
1394 u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); 1378 u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL);
1395 u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES; 1379 u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES;
1396 } 1380 }
diff --git a/drivers/usb/class/bluetty.c b/drivers/usb/class/bluetty.c
index 6bac65e0ade7..524023327c49 100644
--- a/drivers/usb/class/bluetty.c
+++ b/drivers/usb/class/bluetty.c
@@ -309,7 +309,7 @@ static int bluetooth_ctrl_msg (struct usb_bluetooth *bluetooth, int request, int
309 } 309 }
310 } 310 }
311 if (urb->transfer_buffer_length < len) { 311 if (urb->transfer_buffer_length < len) {
312 kfree (urb->transfer_buffer); 312 kfree(urb->transfer_buffer);
313 urb->transfer_buffer = kmalloc (len, GFP_KERNEL); 313 urb->transfer_buffer = kmalloc (len, GFP_KERNEL);
314 if (urb->transfer_buffer == NULL) { 314 if (urb->transfer_buffer == NULL) {
315 err ("%s - out of memory", __FUNCTION__); 315 err ("%s - out of memory", __FUNCTION__);
@@ -535,7 +535,7 @@ static int bluetooth_write (struct tty_struct * tty, const unsigned char *buf, i
535 } 535 }
536 536
537exit: 537exit:
538 kfree (temp_buffer); 538 kfree(temp_buffer);
539 539
540 return retval; 540 return retval;
541} 541}
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index b87608b7051b..ef0b35731ff0 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -637,11 +637,8 @@ static int usb_device_open(struct inode *inode, struct file *file)
637 637
638static int usb_device_release(struct inode *inode, struct file *file) 638static int usb_device_release(struct inode *inode, struct file *file)
639{ 639{
640 if (file->private_data) { 640 kfree(file->private_data);
641 kfree(file->private_data); 641 file->private_data = NULL;
642 file->private_data = NULL;
643 }
644
645 return 0; 642 return 0;
646} 643}
647 644
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 15ac4d168862..d2d648ee8640 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -381,7 +381,7 @@ static void hub_tt_kevent (void *arg)
381 dev_err (&hdev->dev, 381 dev_err (&hdev->dev,
382 "clear tt %d (%04x) error %d\n", 382 "clear tt %d (%04x) error %d\n",
383 clear->tt, clear->devinfo, status); 383 clear->tt, clear->devinfo, status);
384 kfree (clear); 384 kfree(clear);
385 } 385 }
386 spin_unlock_irqrestore (&hub->tt.lock, flags); 386 spin_unlock_irqrestore (&hub->tt.lock, flags);
387} 387}
@@ -728,15 +728,11 @@ static void hub_disconnect(struct usb_interface *intf)
728 list_del_init(&hub->event_list); 728 list_del_init(&hub->event_list);
729 spin_unlock_irq(&hub_event_lock); 729 spin_unlock_irq(&hub_event_lock);
730 730
731 if (hub->descriptor) { 731 kfree(hub->descriptor);
732 kfree(hub->descriptor); 732 hub->descriptor = NULL;
733 hub->descriptor = NULL;
734 }
735 733
736 if (hub->status) { 734 kfree(hub->status);
737 kfree(hub->status); 735 hub->status = NULL;
738 hub->status = NULL;
739 }
740 736
741 if (hub->buffer) { 737 if (hub->buffer) {
742 usb_buffer_free(hdev, sizeof(*hub->buffer), hub->buffer, 738 usb_buffer_free(hdev, sizeof(*hub->buffer), hub->buffer,
@@ -2354,7 +2350,7 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1)
2354 schedule_work (&hub->leds); 2350 schedule_work (&hub->leds);
2355 } 2351 }
2356 } 2352 }
2357 kfree (qual); 2353 kfree(qual);
2358} 2354}
2359 2355
2360static unsigned 2356static unsigned
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 2af3f785d5a1..f1762ed6db63 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -2312,9 +2312,8 @@ static struct gs_buf *gs_buf_alloc(unsigned int size, int kmalloc_flags)
2312 */ 2312 */
2313void gs_buf_free(struct gs_buf *gb) 2313void gs_buf_free(struct gs_buf *gb)
2314{ 2314{
2315 if (gb != NULL) { 2315 if (gb) {
2316 if (gb->buf_buf != NULL) 2316 kfree(gb->buf_buf);
2317 kfree(gb->buf_buf);
2318 kfree(gb); 2317 kfree(gb);
2319 } 2318 }
2320} 2319}
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index 9938697ff361..5c38ad869485 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -156,8 +156,7 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci)
156 ehci->periodic = NULL; 156 ehci->periodic = NULL;
157 157
158 /* shadow periodic table */ 158 /* shadow periodic table */
159 if (ehci->pshadow) 159 kfree(ehci->pshadow);
160 kfree (ehci->pshadow);
161 ehci->pshadow = NULL; 160 ehci->pshadow = NULL;
162} 161}
163 162
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 98745a072d6f..49bd83ee0c75 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -890,8 +890,7 @@ up_failed:
890 debugfs_remove(uhci_debugfs_root); 890 debugfs_remove(uhci_debugfs_root);
891 891
892debug_failed: 892debug_failed:
893 if (errbuf) 893 kfree(errbuf);
894 kfree(errbuf);
895 894
896errbuf_failed: 895errbuf_failed:
897 896
@@ -906,9 +905,7 @@ static void __exit uhci_hcd_cleanup(void)
906 warn("not all urb_priv's were freed!"); 905 warn("not all urb_priv's were freed!");
907 906
908 debugfs_remove(uhci_debugfs_root); 907 debugfs_remove(uhci_debugfs_root);
909 908 kfree(errbuf);
910 if (errbuf)
911 kfree(errbuf);
912} 909}
913 910
914module_init(uhci_hcd_init); 911module_init(uhci_hcd_init);
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index e625997694df..869ff73690ac 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -558,8 +558,7 @@ static void hid_free_device(struct hid_device *device)
558 } 558 }
559 } 559 }
560 560
561 if (device->rdesc) 561 kfree(device->rdesc);
562 kfree(device->rdesc);
563 kfree(device); 562 kfree(device);
564} 563}
565 564
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
5962error_out: 5958error_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
3626fail: /* Free unused memory */ 3626fail: /* 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);
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
index a530bb976e43..6f7994f5a714 100644
--- a/drivers/usb/misc/auerswald.c
+++ b/drivers/usb/misc/auerswald.c
@@ -705,16 +705,12 @@ static int auerchain_control_msg (pauerchain_t acp, struct usb_device *dev, unsi
705/* free a single auerbuf */ 705/* free a single auerbuf */
706static void auerbuf_free (pauerbuf_t bp) 706static void auerbuf_free (pauerbuf_t bp)
707{ 707{
708 if (bp->bufp) { 708 kfree(bp->bufp);
709 kfree (bp->bufp); 709 kfree(bp->dr);
710 }
711 if (bp->dr) {
712 kfree (bp->dr);
713 }
714 if (bp->urbp) { 710 if (bp->urbp) {
715 usb_free_urb (bp->urbp); 711 usb_free_urb(bp->urbp);
716 } 712 }
717 kfree (bp); 713 kfree(bp);
718} 714}
719 715
720/* free the buffers from an auerbuf list */ 716/* free the buffers from an auerbuf list */
@@ -1093,14 +1089,12 @@ exit:
1093*/ 1089*/
1094static void auerswald_int_free (pauerswald_t cp) 1090static void auerswald_int_free (pauerswald_t cp)
1095{ 1091{
1096 if (cp->inturbp) { 1092 if (cp->inturbp) {
1097 usb_free_urb (cp->inturbp); 1093 usb_free_urb(cp->inturbp);
1098 cp->inturbp = NULL; 1094 cp->inturbp = NULL;
1099 } 1095 }
1100 if (cp->intbufp) { 1096 kfree(cp->intbufp);
1101 kfree (cp->intbufp); 1097 cp->intbufp = NULL;
1102 cp->intbufp = NULL;
1103 }
1104} 1098}
1105 1099
1106/* This function is called to activate the interrupt 1100/* This function is called to activate the interrupt
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c
index 938025e2c646..c81cd0a619bf 100644
--- a/drivers/usb/net/zd1201.c
+++ b/drivers/usb/net/zd1201.c
@@ -106,8 +106,7 @@ int zd1201_fw_upload(struct usb_device *dev, int apfw)
106 106
107 err = 0; 107 err = 0;
108exit: 108exit:
109 if (buf) 109 kfree(buf);
110 kfree(buf);
111 release_firmware(fw_entry); 110 release_firmware(fw_entry);
112 return err; 111 return err;
113} 112}
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index 86994d117c44..abb1b2c543bb 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -202,8 +202,7 @@ static void belkin_sa_shutdown (struct usb_serial *serial)
202 for (i=0; i < serial->num_ports; ++i) { 202 for (i=0; i < serial->num_ports; ++i) {
203 /* My special items, the standard routines free my urbs */ 203 /* My special items, the standard routines free my urbs */
204 priv = usb_get_serial_port_data(serial->port[i]); 204 priv = usb_get_serial_port_data(serial->port[i]);
205 if (priv) 205 kfree(priv);
206 kfree(priv);
207 } 206 }
208} 207}
209 208
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index db8f472d9e3f..d165f42d560d 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -1340,9 +1340,8 @@ static struct cypress_buf *cypress_buf_alloc(unsigned int size)
1340 1340
1341static void cypress_buf_free(struct cypress_buf *cb) 1341static void cypress_buf_free(struct cypress_buf *cb)
1342{ 1342{
1343 if (cb != NULL) { 1343 if (cb) {
1344 if (cb->buf_buf != NULL) 1344 kfree(cb->buf_buf);
1345 kfree(cb->buf_buf);
1346 kfree(cb); 1345 kfree(cb);
1347 } 1346 }
1348} 1347}
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
index 4d46394f351b..8d562ab454a8 100644
--- a/drivers/usb/serial/empeg.c
+++ b/drivers/usb/serial/empeg.c
@@ -550,8 +550,7 @@ failed_usb_register:
550failed_usb_serial_register: 550failed_usb_serial_register:
551 for (i = 0; i < NUM_URBS; ++i) { 551 for (i = 0; i < NUM_URBS; ++i) {
552 if (write_urb_pool[i]) { 552 if (write_urb_pool[i]) {
553 if (write_urb_pool[i]->transfer_buffer) 553 kfree(write_urb_pool[i]->transfer_buffer);
554 kfree(write_urb_pool[i]->transfer_buffer);
555 usb_free_urb(write_urb_pool[i]); 554 usb_free_urb(write_urb_pool[i]);
556 } 555 }
557 } 556 }
@@ -575,8 +574,7 @@ static void __exit empeg_exit (void)
575 * the host controllers get fixed to set urb->dev = NULL after 574 * the host controllers get fixed to set urb->dev = NULL after
576 * the urb is finished. Otherwise this call oopses. */ 575 * the urb is finished. Otherwise this call oopses. */
577 /* usb_kill_urb(write_urb_pool[i]); */ 576 /* usb_kill_urb(write_urb_pool[i]); */
578 if (write_urb_pool[i]->transfer_buffer) 577 kfree(write_urb_pool[i]->transfer_buffer);
579 kfree(write_urb_pool[i]->transfer_buffer);
580 usb_free_urb (write_urb_pool[i]); 578 usb_free_urb (write_urb_pool[i]);
581 } 579 }
582 } 580 }
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 4afd905fe2fe..4c788c767a97 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1347,9 +1347,7 @@ static int ftdi_common_startup (struct usb_serial *serial)
1347 priv->flags = ASYNC_LOW_LATENCY; 1347 priv->flags = ASYNC_LOW_LATENCY;
1348 1348
1349 /* Increase the size of read buffers */ 1349 /* Increase the size of read buffers */
1350 if (port->bulk_in_buffer) { 1350 kfree(port->bulk_in_buffer);
1351 kfree (port->bulk_in_buffer);
1352 }
1353 port->bulk_in_buffer = kmalloc (BUFSZ, GFP_KERNEL); 1351 port->bulk_in_buffer = kmalloc (BUFSZ, GFP_KERNEL);
1354 if (!port->bulk_in_buffer) { 1352 if (!port->bulk_in_buffer) {
1355 kfree (priv); 1353 kfree (priv);
@@ -1365,10 +1363,8 @@ static int ftdi_common_startup (struct usb_serial *serial)
1365 usb_free_urb (port->write_urb); 1363 usb_free_urb (port->write_urb);
1366 port->write_urb = NULL; 1364 port->write_urb = NULL;
1367 } 1365 }
1368 if (port->bulk_out_buffer) { 1366 kfree(port->bulk_out_buffer);
1369 kfree (port->bulk_out_buffer); 1367 port->bulk_out_buffer = NULL;
1370 port->bulk_out_buffer = NULL;
1371 }
1372 1368
1373 usb_set_serial_port_data(serial->port[0], priv); 1369 usb_set_serial_port_data(serial->port[0], priv);
1374 1370
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index e35b5adcd5fe..04bfe279d763 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -951,9 +951,7 @@ static void edge_bulk_out_cmd_callback (struct urb *urb, struct pt_regs *regs)
951 951
952 952
953 /* clean up the transfer buffer */ 953 /* clean up the transfer buffer */
954 if (urb->transfer_buffer != NULL) { 954 kfree(urb->transfer_buffer);
955 kfree(urb->transfer_buffer);
956 }
957 955
958 /* Free the command urb */ 956 /* Free the command urb */
959 usb_free_urb (urb); 957 usb_free_urb (urb);
@@ -1266,16 +1264,12 @@ static void edge_close (struct usb_serial_port *port, struct file * filp)
1266 1264
1267 if (edge_port->write_urb) { 1265 if (edge_port->write_urb) {
1268 /* if this urb had a transfer buffer already (old transfer) free it */ 1266 /* if this urb had a transfer buffer already (old transfer) free it */
1269 if (edge_port->write_urb->transfer_buffer != NULL) { 1267 kfree(edge_port->write_urb->transfer_buffer);
1270 kfree(edge_port->write_urb->transfer_buffer); 1268 usb_free_urb(edge_port->write_urb);
1271 }
1272 usb_free_urb (edge_port->write_urb);
1273 edge_port->write_urb = NULL; 1269 edge_port->write_urb = NULL;
1274 } 1270 }
1275 if (edge_port->txfifo.fifo) { 1271 kfree(edge_port->txfifo.fifo);
1276 kfree(edge_port->txfifo.fifo); 1272 edge_port->txfifo.fifo = NULL;
1277 edge_port->txfifo.fifo = NULL;
1278 }
1279 1273
1280 dbg("%s exited", __FUNCTION__); 1274 dbg("%s exited", __FUNCTION__);
1281} 1275}
@@ -1419,11 +1413,9 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge
1419 // get a pointer to the write_urb 1413 // get a pointer to the write_urb
1420 urb = edge_port->write_urb; 1414 urb = edge_port->write_urb;
1421 1415
1422 /* if this urb had a transfer buffer already (old transfer) free it */ 1416 /* make sure transfer buffer is freed */
1423 if (urb->transfer_buffer != NULL) { 1417 kfree(urb->transfer_buffer);
1424 kfree(urb->transfer_buffer); 1418 urb->transfer_buffer = NULL;
1425 urb->transfer_buffer = NULL;
1426 }
1427 1419
1428 /* build the data header for the buffer and port that we are about to send out */ 1420 /* build the data header for the buffer and port that we are about to send out */
1429 count = fifo->count; 1421 count = fifo->count;
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 6c96fdaec36e..ebf9967f7c86 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2845,9 +2845,8 @@ static struct edge_buf *edge_buf_alloc(unsigned int size)
2845 2845
2846void edge_buf_free(struct edge_buf *eb) 2846void edge_buf_free(struct edge_buf *eb)
2847{ 2847{
2848 if (eb != NULL) { 2848 if (eb) {
2849 if (eb->buf_buf != NULL) 2849 kfree(eb->buf_buf);
2850 kfree(eb->buf_buf);
2851 kfree(eb); 2850 kfree(eb);
2852 } 2851 }
2853} 2852}
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index 49c602a0b4df..a11e829e38c8 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -341,8 +341,7 @@ static void klsi_105_shutdown (struct usb_serial *serial)
341 * finished. Otherwise this call 341 * finished. Otherwise this call
342 * oopses. */ 342 * oopses. */
343 /* usb_kill_urb(write_urbs[j]); */ 343 /* usb_kill_urb(write_urbs[j]); */
344 if (write_urbs[j]->transfer_buffer) 344 kfree(write_urbs[j]->transfer_buffer);
345 kfree(write_urbs[j]->transfer_buffer);
346 usb_free_urb (write_urbs[j]); 345 usb_free_urb (write_urbs[j]);
347 } 346 }
348 } 347 }
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index a1cba4b5fa23..b5f2c06d4f3e 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -178,7 +178,6 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp)
178{ 178{
179 struct usb_serial *serial = port->serial; 179 struct usb_serial *serial = port->serial;
180 struct usb_serial_port *wport; 180 struct usb_serial_port *wport;
181 struct omninet_data *od;
182 181
183 dbg("%s - port %d", __FUNCTION__, port->number); 182 dbg("%s - port %d", __FUNCTION__, port->number);
184 183
@@ -186,9 +185,7 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp)
186 usb_kill_urb(wport->write_urb); 185 usb_kill_urb(wport->write_urb);
187 usb_kill_urb(port->read_urb); 186 usb_kill_urb(port->read_urb);
188 187
189 od = usb_get_serial_port_data(port); 188 kfree(usb_get_serial_port_data(port));
190 if (od)
191 kfree(od);
192} 189}
193 190
194 191
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 8e9b007bf44d..7eab5d4cf3a8 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -1044,9 +1044,8 @@ static struct pl2303_buf *pl2303_buf_alloc(unsigned int size)
1044 1044
1045static void pl2303_buf_free(struct pl2303_buf *pb) 1045static void pl2303_buf_free(struct pl2303_buf *pb)
1046{ 1046{
1047 if (pb != NULL) { 1047 if (pb) {
1048 if (pb->buf_buf != NULL) 1048 kfree(pb->buf_buf);
1049 kfree(pb->buf_buf);
1050 kfree(pb); 1049 kfree(pb);
1051 } 1050 }
1052} 1051}
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 98054876cca2..59c88de3e7ae 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -517,8 +517,7 @@ static void ti_shutdown(struct usb_serial *serial)
517 } 517 }
518 } 518 }
519 519
520 if (tdev) 520 kfree(tdev);
521 kfree(tdev);
522 usb_set_serial_data(serial, NULL); 521 usb_set_serial_data(serial, NULL);
523} 522}
524 523
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
index 229ca181716b..8451779f4269 100644
--- a/drivers/usb/storage/sddr55.c
+++ b/drivers/usb/storage/sddr55.c
@@ -119,10 +119,8 @@ static int sddr55_status(struct us_data *us)
119 /* expect to get short transfer if no card fitted */ 119 /* expect to get short transfer if no card fitted */
120 if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) { 120 if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) {
121 /* had a short transfer, no card inserted, free map memory */ 121 /* had a short transfer, no card inserted, free map memory */
122 if (info->lba_to_pba) 122 kfree(info->lba_to_pba);
123 kfree(info->lba_to_pba); 123 kfree(info->pba_to_lba);
124 if (info->pba_to_lba)
125 kfree(info->pba_to_lba);
126 info->lba_to_pba = NULL; 124 info->lba_to_pba = NULL;
127 info->pba_to_lba = NULL; 125 info->pba_to_lba = NULL;
128 126
@@ -649,18 +647,14 @@ static int sddr55_read_map(struct us_data *us) {
649 return -1; 647 return -1;
650 } 648 }
651 649
652 if (info->lba_to_pba) 650 kfree(info->lba_to_pba);
653 kfree(info->lba_to_pba); 651 kfree(info->pba_to_lba);
654 if (info->pba_to_lba)
655 kfree(info->pba_to_lba);
656 info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO); 652 info->lba_to_pba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
657 info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO); 653 info->pba_to_lba = kmalloc(numblocks*sizeof(int), GFP_NOIO);
658 654
659 if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) { 655 if (info->lba_to_pba == NULL || info->pba_to_lba == NULL) {
660 if (info->lba_to_pba != NULL) 656 kfree(info->lba_to_pba);
661 kfree(info->lba_to_pba); 657 kfree(info->pba_to_lba);
662 if (info->pba_to_lba != NULL)
663 kfree(info->pba_to_lba);
664 info->lba_to_pba = NULL; 658 info->lba_to_pba = NULL;
665 info->pba_to_lba = NULL; 659 info->pba_to_lba = NULL;
666 kfree(buffer); 660 kfree(buffer);
@@ -728,10 +722,8 @@ static void sddr55_card_info_destructor(void *extra) {
728 if (!extra) 722 if (!extra)
729 return; 723 return;
730 724
731 if (info->lba_to_pba) 725 kfree(info->lba_to_pba);
732 kfree(info->lba_to_pba); 726 kfree(info->pba_to_lba);
733 if (info->pba_to_lba)
734 kfree(info->pba_to_lba);
735} 727}
736 728
737 729