]> err.no Git - linux-2.6/commitdiff
USB HID: usb_buffer_free() cleanup
authorDmitry Torokhov <dtor@insightbb.com>
Thu, 3 May 2007 05:04:52 +0000 (01:04 -0400)
committerJiri Kosina <jkosina@suse.cz>
Wed, 9 May 2007 00:52:51 +0000 (02:52 +0200)
usb_buffer_free() now handles NULLs so remove unneeded checks
form callers.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/usbhid/hid-core.c
drivers/hid/usbhid/usbkbd.c

index 1c0bd481219c1bc8961811ba9579c9c2bd66f96c..d06b9e70ce6a5b24d265de0118534f9fa5753094 100644 (file)
@@ -626,14 +626,10 @@ static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid)
 {
        struct usbhid_device *usbhid = hid->driver_data;
 
-       if (usbhid->inbuf)
-               usb_buffer_free(dev, usbhid->bufsize, usbhid->inbuf, usbhid->inbuf_dma);
-       if (usbhid->outbuf)
-               usb_buffer_free(dev, usbhid->bufsize, usbhid->outbuf, usbhid->outbuf_dma);
-       if (usbhid->cr)
-               usb_buffer_free(dev, sizeof(*(usbhid->cr)), usbhid->cr, usbhid->cr_dma);
-       if (usbhid->ctrlbuf)
-               usb_buffer_free(dev, usbhid->bufsize, usbhid->ctrlbuf, usbhid->ctrlbuf_dma);
+       usb_buffer_free(dev, usbhid->bufsize, usbhid->inbuf, usbhid->inbuf_dma);
+       usb_buffer_free(dev, usbhid->bufsize, usbhid->outbuf, usbhid->outbuf_dma);
+       usb_buffer_free(dev, sizeof(*(usbhid->cr)), usbhid->cr, usbhid->cr_dma);
+       usb_buffer_free(dev, usbhid->bufsize, usbhid->ctrlbuf, usbhid->ctrlbuf_dma);
 }
 
 /*
index 65aa12e8d7b3f309661e87820362463132ca200f..36ddc7a7a42707b6ec40a598fa85fbf62712ac7d 100644 (file)
@@ -211,12 +211,9 @@ static void usb_kbd_free_mem(struct usb_device *dev, struct usb_kbd *kbd)
 {
        usb_free_urb(kbd->irq);
        usb_free_urb(kbd->led);
-       if (kbd->new)
-               usb_buffer_free(dev, 8, kbd->new, kbd->new_dma);
-       if (kbd->cr)
-               usb_buffer_free(dev, sizeof(struct usb_ctrlrequest), kbd->cr, kbd->cr_dma);
-       if (kbd->leds)
-               usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma);
+       usb_buffer_free(dev, 8, kbd->new, kbd->new_dma);
+       usb_buffer_free(dev, sizeof(struct usb_ctrlrequest), kbd->cr, kbd->cr_dma);
+       usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma);
 }
 
 static int usb_kbd_probe(struct usb_interface *iface,