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/core | |
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/core')
-rw-r--r-- | drivers/usb/core/devices.c | 7 | ||||
-rw-r--r-- | drivers/usb/core/hub.c | 16 |
2 files changed, 8 insertions, 15 deletions
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 | ||
638 | static int usb_device_release(struct inode *inode, struct file *file) | 638 | static 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 | ||
2360 | static unsigned | 2356 | static unsigned |