diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2007-04-12 01:33:39 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2007-04-12 01:33:39 -0400 |
commit | 5014186de89708d0e9eed60526b698d5b786b707 (patch) | |
tree | 949ea6219db7779f635a34278325bd2d9617c657 /drivers/usb/input/appletouch.c | |
parent | db61a9124880a1d79b7b320d4b6bef717f23e485 (diff) |
Input: USB devices - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/usb/input/appletouch.c')
-rw-r--r-- | drivers/usb/input/appletouch.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/usb/input/appletouch.c b/drivers/usb/input/appletouch.c index c77291d3d063..36221329a4ef 100644 --- a/drivers/usb/input/appletouch.c +++ b/drivers/usb/input/appletouch.c | |||
@@ -491,8 +491,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id | |||
491 | struct usb_host_interface *iface_desc; | 491 | struct usb_host_interface *iface_desc; |
492 | struct usb_endpoint_descriptor *endpoint; | 492 | struct usb_endpoint_descriptor *endpoint; |
493 | int int_in_endpointAddr = 0; | 493 | int int_in_endpointAddr = 0; |
494 | int i, retval = -ENOMEM; | 494 | int i, error = -ENOMEM; |
495 | |||
496 | 495 | ||
497 | /* set up the endpoint information */ | 496 | /* set up the endpoint information */ |
498 | /* use only the first interrupt-in endpoint */ | 497 | /* use only the first interrupt-in endpoint */ |
@@ -567,17 +566,13 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id | |||
567 | } | 566 | } |
568 | 567 | ||
569 | dev->urb = usb_alloc_urb(0, GFP_KERNEL); | 568 | dev->urb = usb_alloc_urb(0, GFP_KERNEL); |
570 | if (!dev->urb) { | 569 | if (!dev->urb) |
571 | retval = -ENOMEM; | ||
572 | goto err_free_devs; | 570 | goto err_free_devs; |
573 | } | ||
574 | 571 | ||
575 | dev->data = usb_buffer_alloc(dev->udev, dev->datalen, GFP_KERNEL, | 572 | dev->data = usb_buffer_alloc(dev->udev, dev->datalen, GFP_KERNEL, |
576 | &dev->urb->transfer_dma); | 573 | &dev->urb->transfer_dma); |
577 | if (!dev->data) { | 574 | if (!dev->data) |
578 | retval = -ENOMEM; | ||
579 | goto err_free_urb; | 575 | goto err_free_urb; |
580 | } | ||
581 | 576 | ||
582 | usb_fill_int_urb(dev->urb, udev, | 577 | usb_fill_int_urb(dev->urb, udev, |
583 | usb_rcvintpipe(udev, int_in_endpointAddr), | 578 | usb_rcvintpipe(udev, int_in_endpointAddr), |
@@ -633,20 +628,25 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id | |||
633 | set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); | 628 | set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); |
634 | set_bit(BTN_LEFT, input_dev->keybit); | 629 | set_bit(BTN_LEFT, input_dev->keybit); |
635 | 630 | ||
636 | input_register_device(dev->input); | 631 | error = input_register_device(dev->input); |
632 | if (error) | ||
633 | goto err_free_buffer; | ||
637 | 634 | ||
638 | /* save our data pointer in this interface device */ | 635 | /* save our data pointer in this interface device */ |
639 | usb_set_intfdata(iface, dev); | 636 | usb_set_intfdata(iface, dev); |
640 | 637 | ||
641 | return 0; | 638 | return 0; |
642 | 639 | ||
640 | err_free_buffer: | ||
641 | usb_buffer_free(dev->udev, dev->datalen, | ||
642 | dev->data, dev->urb->transfer_dma); | ||
643 | err_free_urb: | 643 | err_free_urb: |
644 | usb_free_urb(dev->urb); | 644 | usb_free_urb(dev->urb); |
645 | err_free_devs: | 645 | err_free_devs: |
646 | usb_set_intfdata(iface, NULL); | 646 | usb_set_intfdata(iface, NULL); |
647 | kfree(dev); | 647 | kfree(dev); |
648 | input_free_device(input_dev); | 648 | input_free_device(input_dev); |
649 | return retval; | 649 | return error; |
650 | } | 650 | } |
651 | 651 | ||
652 | static void atp_disconnect(struct usb_interface *iface) | 652 | static void atp_disconnect(struct usb_interface *iface) |