diff options
author | Jesper Juhl <juhl-lkml@dif.dk> | 2005-04-19 04:39:34 +0400 |
---|---|---|
committer | Greg K-H <gregkh@suse.de> | 2005-04-19 04:39:34 +0400 |
commit | 1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f (patch) | |
tree | 0bc14ec53acf3b4c08a9995c7ea335e236435558 /drivers/usb/class | |
parent | 6fd19f4b55f7fd1c9d8650bd7f8df2c81b69c5ca (diff) | |
download | linux-1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f.tar.xz |
[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.c | 48 | ||||
-rw-r--r-- | drivers/usb/class/bluetty.c | 4 |
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) } } set_current_state(TASK_RUNNING); - if (u->durb[0].urb->transfer_buffer) - kfree(u->durb[0].urb->transfer_buffer); - if (u->durb[1].urb->transfer_buffer) - kfree(u->durb[1].urb->transfer_buffer); - if (u->surb[0].urb->transfer_buffer) - kfree(u->surb[0].urb->transfer_buffer); - if (u->surb[1].urb->transfer_buffer) - kfree(u->surb[1].urb->transfer_buffer); + kfree(u->durb[0].urb->transfer_buffer); + kfree(u->durb[1].urb->transfer_buffer); + kfree(u->surb[0].urb->transfer_buffer); + kfree(u->surb[1].urb->transfer_buffer); u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer = u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL; } @@ -1009,21 +1005,17 @@ static int usbin_start(struct usb_audiodev *as) u->phase = 0; maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format)); bufsz = DESCFRAMES * maxsze; - if (u->durb[0].urb->transfer_buffer) - kfree(u->durb[0].urb->transfer_buffer); + kfree(u->durb[0].urb->transfer_buffer); u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); u->durb[0].urb->transfer_buffer_length = bufsz; - if (u->durb[1].urb->transfer_buffer) - kfree(u->durb[1].urb->transfer_buffer); + kfree(u->durb[1].urb->transfer_buffer); u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); u->durb[1].urb->transfer_buffer_length = bufsz; if (u->syncpipe) { - if (u->surb[0].urb->transfer_buffer) - kfree(u->surb[0].urb->transfer_buffer); + kfree(u->surb[0].urb->transfer_buffer); u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES; - if (u->surb[1].urb->transfer_buffer) - kfree(u->surb[1].urb->transfer_buffer); + kfree(u->surb[1].urb->transfer_buffer); u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES; } @@ -1128,14 +1120,10 @@ static void usbout_stop(struct usb_audiodev *as) } } set_current_state(TASK_RUNNING); - if (u->durb[0].urb->transfer_buffer) - kfree(u->durb[0].urb->transfer_buffer); - if (u->durb[1].urb->transfer_buffer) - kfree(u->durb[1].urb->transfer_buffer); - if (u->surb[0].urb->transfer_buffer) - kfree(u->surb[0].urb->transfer_buffer); - if (u->surb[1].urb->transfer_buffer) - kfree(u->surb[1].urb->transfer_buffer); + kfree(u->durb[0].urb->transfer_buffer); + kfree(u->durb[1].urb->transfer_buffer); + kfree(u->surb[0].urb->transfer_buffer); + kfree(u->surb[1].urb->transfer_buffer); u->durb[0].urb->transfer_buffer = u->durb[1].urb->transfer_buffer = u->surb[0].urb->transfer_buffer = u->surb[1].urb->transfer_buffer = NULL; } @@ -1376,21 +1364,17 @@ static int usbout_start(struct usb_audiodev *as) u->phase = 0; maxsze = (u->freqmax + 0x3fff) >> (14 - AFMT_BYTESSHIFT(u->format)); bufsz = DESCFRAMES * maxsze; - if (u->durb[0].urb->transfer_buffer) - kfree(u->durb[0].urb->transfer_buffer); + kfree(u->durb[0].urb->transfer_buffer); u->durb[0].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); u->durb[0].urb->transfer_buffer_length = bufsz; - if (u->durb[1].urb->transfer_buffer) - kfree(u->durb[1].urb->transfer_buffer); + kfree(u->durb[1].urb->transfer_buffer); u->durb[1].urb->transfer_buffer = kmalloc(bufsz, GFP_KERNEL); u->durb[1].urb->transfer_buffer_length = bufsz; if (u->syncpipe) { - if (u->surb[0].urb->transfer_buffer) - kfree(u->surb[0].urb->transfer_buffer); + kfree(u->surb[0].urb->transfer_buffer); u->surb[0].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); u->surb[0].urb->transfer_buffer_length = 3*SYNCFRAMES; - if (u->surb[1].urb->transfer_buffer) - kfree(u->surb[1].urb->transfer_buffer); + kfree(u->surb[1].urb->transfer_buffer); u->surb[1].urb->transfer_buffer = kmalloc(3*SYNCFRAMES, GFP_KERNEL); u->surb[1].urb->transfer_buffer_length = 3*SYNCFRAMES; } 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 } } if (urb->transfer_buffer_length < len) { - kfree (urb->transfer_buffer); + kfree(urb->transfer_buffer); urb->transfer_buffer = kmalloc (len, GFP_KERNEL); if (urb->transfer_buffer == NULL) { err ("%s - out of memory", __FUNCTION__); @@ -535,7 +535,7 @@ static int bluetooth_write (struct tty_struct * tty, const unsigned char *buf, i } exit: - kfree (temp_buffer); + kfree(temp_buffer); return retval; } |