aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2007-05-03 00:57:29 -0400
committerDmitry Torokhov <dtor@insightbb.com>2007-05-03 00:57:29 -0400
commite37a97d44038700ff8c2f1080f71fdfc3a4c0c1e (patch)
treec78b612f6cca1efd305743c4bdce237f06975965 /drivers/usb/input
parent4bdd488f4bf7dc91b371fe160a4718b0a91bb2a4 (diff)
Input: drivers/usb/input - usb_buffer_free() cleanup
usb_buffer_free() now handles NULLs so remove unneeded checks form callers. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/usb/input')
-rw-r--r--drivers/usb/input/ati_remote2.c4
-rw-r--r--drivers/usb/input/powermate.c10
-rw-r--r--drivers/usb/input/usbtouchscreen.c5
-rw-r--r--drivers/usb/input/yealink.c23
4 files changed, 18 insertions, 24 deletions
diff --git a/drivers/usb/input/ati_remote2.c b/drivers/usb/input/ati_remote2.c
index a9032aa3465f..1031543e5c3f 100644
--- a/drivers/usb/input/ati_remote2.c
+++ b/drivers/usb/input/ati_remote2.c
@@ -405,9 +405,7 @@ static void ati_remote2_urb_cleanup(struct ati_remote2 *ar2)
405 405
406 for (i = 0; i < 2; i++) { 406 for (i = 0; i < 2; i++) {
407 usb_free_urb(ar2->urb[i]); 407 usb_free_urb(ar2->urb[i]);
408 408 usb_buffer_free(ar2->udev, 4, ar2->buf[i], ar2->buf_dma[i]);
409 if (ar2->buf[i])
410 usb_buffer_free(ar2->udev, 4, ar2->buf[i], ar2->buf_dma[i]);
411 } 409 }
412} 410}
413 411
diff --git a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c
index 4f93a760faee..448a470d28f2 100644
--- a/drivers/usb/input/powermate.c
+++ b/drivers/usb/input/powermate.c
@@ -291,12 +291,10 @@ static int powermate_alloc_buffers(struct usb_device *udev, struct powermate_dev
291 291
292static void powermate_free_buffers(struct usb_device *udev, struct powermate_device *pm) 292static void powermate_free_buffers(struct usb_device *udev, struct powermate_device *pm)
293{ 293{
294 if (pm->data) 294 usb_buffer_free(udev, POWERMATE_PAYLOAD_SIZE_MAX,
295 usb_buffer_free(udev, POWERMATE_PAYLOAD_SIZE_MAX, 295 pm->data, pm->data_dma);
296 pm->data, pm->data_dma); 296 usb_buffer_free(udev, sizeof(*(pm->configcr)),
297 if (pm->configcr) 297 pm->configcr, pm->configcr_dma);
298 usb_buffer_free(udev, sizeof(*(pm->configcr)),
299 pm->configcr, pm->configcr_dma);
300} 298}
301 299
302/* Called whenever a USB device matching one in our supported devices table is connected */ 300/* Called whenever a USB device matching one in our supported devices table is connected */
diff --git a/drivers/usb/input/usbtouchscreen.c b/drivers/usb/input/usbtouchscreen.c
index e0829413336b..8e18e6c64777 100644
--- a/drivers/usb/input/usbtouchscreen.c
+++ b/drivers/usb/input/usbtouchscreen.c
@@ -668,9 +668,8 @@ static void usbtouch_close(struct input_dev *input)
668static void usbtouch_free_buffers(struct usb_device *udev, 668static void usbtouch_free_buffers(struct usb_device *udev,
669 struct usbtouch_usb *usbtouch) 669 struct usbtouch_usb *usbtouch)
670{ 670{
671 if (usbtouch->data) 671 usb_buffer_free(udev, usbtouch->type->rept_size,
672 usb_buffer_free(udev, usbtouch->type->rept_size, 672 usbtouch->data, usbtouch->data_dma);
673 usbtouch->data, usbtouch->data_dma);
674 kfree(usbtouch->buffer); 673 kfree(usbtouch->buffer);
675} 674}
676 675
diff --git a/drivers/usb/input/yealink.c b/drivers/usb/input/yealink.c
index c54f1a5dcb4a..fc645b299189 100644
--- a/drivers/usb/input/yealink.c
+++ b/drivers/usb/input/yealink.c
@@ -818,18 +818,17 @@ static int usb_cleanup(struct yealink_dev *yld, int err)
818 else 818 else
819 input_unregister_device(yld->idev); 819 input_unregister_device(yld->idev);
820 } 820 }
821 if (yld->ctl_req) 821
822 usb_buffer_free(yld->udev, sizeof(*(yld->ctl_req)), 822 usb_free_urb(yld->urb_irq);
823 yld->ctl_req, yld->ctl_req_dma); 823 usb_free_urb(yld->urb_ctl);
824 if (yld->ctl_data) 824
825 usb_buffer_free(yld->udev, USB_PKT_LEN, 825 usb_buffer_free(yld->udev, sizeof(*(yld->ctl_req)),
826 yld->ctl_data, yld->ctl_dma); 826 yld->ctl_req, yld->ctl_req_dma);
827 if (yld->irq_data) 827 usb_buffer_free(yld->udev, USB_PKT_LEN,
828 usb_buffer_free(yld->udev, USB_PKT_LEN, 828 yld->ctl_data, yld->ctl_dma);
829 yld->irq_data, yld->irq_dma); 829 usb_buffer_free(yld->udev, USB_PKT_LEN,
830 830 yld->irq_data, yld->irq_dma);
831 usb_free_urb(yld->urb_irq); /* parameter validation in core/urb */ 831
832 usb_free_urb(yld->urb_ctl); /* parameter validation in core/urb */
833 kfree(yld); 832 kfree(yld);
834 return err; 833 return err;
835} 834}