Input: drivers/usb/input - usb_buffer_free() cleanup
authorDmitry Torokhov <dtor@insightbb.com>
Thu, 3 May 2007 04:57:29 +0000 (00:57 -0400)
committerDmitry Torokhov <dtor@insightbb.com>
Thu, 3 May 2007 04:57:29 +0000 (00:57 -0400)
usb_buffer_free() now handles NULLs so remove unneeded checks
form callers.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/usb/input/ati_remote2.c
drivers/usb/input/powermate.c
drivers/usb/input/usbtouchscreen.c
drivers/usb/input/yealink.c

index a9032aa3465f7bb5d70806af6bb4d55b0cee041a..1031543e5c3f3e1f71e4e15bcae5ae600aa0f087 100644 (file)
@@ -405,9 +405,7 @@ static void ati_remote2_urb_cleanup(struct ati_remote2 *ar2)
 
        for (i = 0; i < 2; i++) {
                usb_free_urb(ar2->urb[i]);
-
-               if (ar2->buf[i])
-                       usb_buffer_free(ar2->udev, 4, ar2->buf[i], ar2->buf_dma[i]);
+               usb_buffer_free(ar2->udev, 4, ar2->buf[i], ar2->buf_dma[i]);
        }
 }
 
index 4f93a760faeed74c699c23704178341359d2cdad..448a470d28f264d4ee6f666438d162a17225f694 100644 (file)
@@ -291,12 +291,10 @@ static int powermate_alloc_buffers(struct usb_device *udev, struct powermate_dev
 
 static void powermate_free_buffers(struct usb_device *udev, struct powermate_device *pm)
 {
-       if (pm->data)
-               usb_buffer_free(udev, POWERMATE_PAYLOAD_SIZE_MAX,
-                               pm->data, pm->data_dma);
-       if (pm->configcr)
-               usb_buffer_free(udev, sizeof(*(pm->configcr)),
-                               pm->configcr, pm->configcr_dma);
+       usb_buffer_free(udev, POWERMATE_PAYLOAD_SIZE_MAX,
+                       pm->data, pm->data_dma);
+       usb_buffer_free(udev, sizeof(*(pm->configcr)),
+                       pm->configcr, pm->configcr_dma);
 }
 
 /* Called whenever a USB device matching one in our supported devices table is connected */
index e0829413336b669a3d152681982930ec2480e013..8e18e6c6477771566a33b52e12ffbc9f28b8d098 100644 (file)
@@ -668,9 +668,8 @@ static void usbtouch_close(struct input_dev *input)
 static void usbtouch_free_buffers(struct usb_device *udev,
                                  struct usbtouch_usb *usbtouch)
 {
-       if (usbtouch->data)
-               usb_buffer_free(udev, usbtouch->type->rept_size,
-                               usbtouch->data, usbtouch->data_dma);
+       usb_buffer_free(udev, usbtouch->type->rept_size,
+                       usbtouch->data, usbtouch->data_dma);
        kfree(usbtouch->buffer);
 }
 
index c54f1a5dcb4a480ba19fe04d907fa0a9184f4503..fc645b29918966fd8cd6beb9a344971f082b9ce4 100644 (file)
@@ -818,18 +818,17 @@ static int usb_cleanup(struct yealink_dev *yld, int err)
                else
                        input_unregister_device(yld->idev);
        }
-       if (yld->ctl_req)
-               usb_buffer_free(yld->udev, sizeof(*(yld->ctl_req)),
-                               yld->ctl_req, yld->ctl_req_dma);
-       if (yld->ctl_data)
-               usb_buffer_free(yld->udev, USB_PKT_LEN,
-                               yld->ctl_data, yld->ctl_dma);
-       if (yld->irq_data)
-               usb_buffer_free(yld->udev, USB_PKT_LEN,
-                               yld->irq_data, yld->irq_dma);
-
-       usb_free_urb(yld->urb_irq);     /* parameter validation in core/urb */
-       usb_free_urb(yld->urb_ctl);     /* parameter validation in core/urb */
+
+       usb_free_urb(yld->urb_irq);
+       usb_free_urb(yld->urb_ctl);
+
+       usb_buffer_free(yld->udev, sizeof(*(yld->ctl_req)),
+                       yld->ctl_req, yld->ctl_req_dma);
+       usb_buffer_free(yld->udev, USB_PKT_LEN,
+                       yld->ctl_data, yld->ctl_dma);
+       usb_buffer_free(yld->udev, USB_PKT_LEN,
+                       yld->irq_data, yld->irq_dma);
+
        kfree(yld);
        return err;
 }