From 1bc3c9e1e44c2059fe2ffa6ff70ad0a925d7b05f Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Mon, 18 Apr 2005 17:39:34 -0700 Subject: [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 Signed-off-by: Greg Kroah-Hartman Index: gregkh-2.6/drivers/usb/class/audio.c =================================================================== --- drivers/usb/core/devices.c | 7 ++----- drivers/usb/core/hub.c | 16 ++++++---------- 2 files changed, 8 insertions(+), 15 deletions(-) (limited to 'drivers/usb/core') diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index b87608b7051..ef0b35731ff 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) static int usb_device_release(struct inode *inode, struct file *file) { - if (file->private_data) { - kfree(file->private_data); - file->private_data = NULL; - } - + kfree(file->private_data); + file->private_data = NULL; return 0; } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 15ac4d16886..d2d648ee864 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -381,7 +381,7 @@ static void hub_tt_kevent (void *arg) dev_err (&hdev->dev, "clear tt %d (%04x) error %d\n", clear->tt, clear->devinfo, status); - kfree (clear); + kfree(clear); } spin_unlock_irqrestore (&hub->tt.lock, flags); } @@ -728,15 +728,11 @@ static void hub_disconnect(struct usb_interface *intf) list_del_init(&hub->event_list); spin_unlock_irq(&hub_event_lock); - if (hub->descriptor) { - kfree(hub->descriptor); - hub->descriptor = NULL; - } + kfree(hub->descriptor); + hub->descriptor = NULL; - if (hub->status) { - kfree(hub->status); - hub->status = NULL; - } + kfree(hub->status); + hub->status = NULL; if (hub->buffer) { 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) schedule_work (&hub->leds); } } - kfree (qual); + kfree(qual); } static unsigned -- cgit v1.2.3