aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class
diff options
context:
space:
mode:
authorJesper Juhl <juhl-lkml@dif.dk>2005-04-18 20:39:34 -0400
committerGreg K-H <gregkh@suse.de>2005-04-18 20:39:34 -0400
commit1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f (patch)
tree0bc14ec53acf3b4c08a9995c7ea335e236435558 /drivers/usb/class
parent6fd19f4b55f7fd1c9d8650bd7f8df2c81b69c5ca (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/class')
-rw-r--r--drivers/usb/class/audio.c48
-rw-r--r--drivers/usb/class/bluetty.c4
2 files changed, 18 insertions, 34 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}