aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/input/acecad.c19
-rw-r--r--drivers/usb/input/aiptek.c28
-rw-r--r--drivers/usb/input/appletouch.c20
-rw-r--r--drivers/usb/input/ati_remote.c10
-rw-r--r--drivers/usb/input/ati_remote2.c8
-rw-r--r--drivers/usb/input/kbtab.c13
-rw-r--r--drivers/usb/input/keyspan_remote.c20
-rw-r--r--drivers/usb/input/powermate.c20
-rw-r--r--drivers/usb/input/wacom_sys.c12
-rw-r--r--drivers/usb/input/xpad.c12
-rw-r--r--drivers/usb/input/yealink.c4
11 files changed, 99 insertions, 67 deletions
diff --git a/drivers/usb/input/acecad.c b/drivers/usb/input/acecad.c
index 909138e5aa04..270bb050879a 100644
--- a/drivers/usb/input/acecad.c
+++ b/drivers/usb/input/acecad.c
@@ -135,6 +135,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
135 struct usb_acecad *acecad; 135 struct usb_acecad *acecad;
136 struct input_dev *input_dev; 136 struct input_dev *input_dev;
137 int pipe, maxp; 137 int pipe, maxp;
138 int err = -ENOMEM;
138 139
139 if (interface->desc.bNumEndpoints != 1) 140 if (interface->desc.bNumEndpoints != 1)
140 return -ENODEV; 141 return -ENODEV;
@@ -149,16 +150,22 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
149 150
150 acecad = kzalloc(sizeof(struct usb_acecad), GFP_KERNEL); 151 acecad = kzalloc(sizeof(struct usb_acecad), GFP_KERNEL);
151 input_dev = input_allocate_device(); 152 input_dev = input_allocate_device();
152 if (!acecad || !input_dev) 153 if (!acecad || !input_dev) {
154 err = -ENOMEM;
153 goto fail1; 155 goto fail1;
156 }
154 157
155 acecad->data = usb_buffer_alloc(dev, 8, GFP_KERNEL, &acecad->data_dma); 158 acecad->data = usb_buffer_alloc(dev, 8, GFP_KERNEL, &acecad->data_dma);
156 if (!acecad->data) 159 if (!acecad->data) {
160 err= -ENOMEM;
157 goto fail1; 161 goto fail1;
162 }
158 163
159 acecad->irq = usb_alloc_urb(0, GFP_KERNEL); 164 acecad->irq = usb_alloc_urb(0, GFP_KERNEL);
160 if (!acecad->irq) 165 if (!acecad->irq) {
166 err = -ENOMEM;
161 goto fail2; 167 goto fail2;
168 }
162 169
163 acecad->usbdev = dev; 170 acecad->usbdev = dev;
164 acecad->input = input_dev; 171 acecad->input = input_dev;
@@ -221,7 +228,9 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
221 acecad->irq->transfer_dma = acecad->data_dma; 228 acecad->irq->transfer_dma = acecad->data_dma;
222 acecad->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 229 acecad->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
223 230
224 input_register_device(acecad->input); 231 err = input_register_device(acecad->input);
232 if (err)
233 goto fail2;
225 234
226 usb_set_intfdata(intf, acecad); 235 usb_set_intfdata(intf, acecad);
227 236
@@ -230,7 +239,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
230 fail2: usb_buffer_free(dev, 8, acecad->data, acecad->data_dma); 239 fail2: usb_buffer_free(dev, 8, acecad->data, acecad->data_dma);
231 fail1: input_free_device(input_dev); 240 fail1: input_free_device(input_dev);
232 kfree(acecad); 241 kfree(acecad);
233 return -ENOMEM; 242 return err;
234} 243}
235 244
236static void usb_acecad_disconnect(struct usb_interface *intf) 245static void usb_acecad_disconnect(struct usb_interface *intf)
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
index f857935e615c..8c1ab1cbd233 100644
--- a/drivers/usb/input/aiptek.c
+++ b/drivers/usb/input/aiptek.c
@@ -1972,6 +1972,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
1972 AIPTEK_PROGRAMMABLE_DELAY_200, 1972 AIPTEK_PROGRAMMABLE_DELAY_200,
1973 AIPTEK_PROGRAMMABLE_DELAY_300 1973 AIPTEK_PROGRAMMABLE_DELAY_300
1974 }; 1974 };
1975 int err = -ENOMEM;
1975 1976
1976 /* programmableDelay is where the command-line specified 1977 /* programmableDelay is where the command-line specified
1977 * delay is kept. We make it the first element of speeds[], 1978 * delay is kept. We make it the first element of speeds[],
@@ -2133,7 +2134,9 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2133 2134
2134 /* Register the tablet as an Input Device 2135 /* Register the tablet as an Input Device
2135 */ 2136 */
2136 input_register_device(aiptek->inputdev); 2137 err = input_register_device(aiptek->inputdev);
2138 if (err)
2139 goto fail2;
2137 2140
2138 /* We now will look for the evdev device which is mapped to 2141 /* We now will look for the evdev device which is mapped to
2139 * the tablet. The partial name is kept in the link list of 2142 * the tablet. The partial name is kept in the link list of
@@ -2165,23 +2168,13 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2165 2168
2166 return 0; 2169 return 0;
2167 2170
2168fail2: usb_buffer_free(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data, 2171 fail2: usb_buffer_free(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data,
2169 aiptek->data_dma); 2172 aiptek->data_dma);
2170fail1: input_free_device(inputdev); 2173 fail1: input_free_device(inputdev);
2171 kfree(aiptek); 2174 kfree(aiptek);
2172 return -ENOMEM; 2175 return err;
2173} 2176}
2174 2177
2175/* Forward declaration */
2176static void aiptek_disconnect(struct usb_interface *intf);
2177
2178static struct usb_driver aiptek_driver = {
2179 .name = "aiptek",
2180 .probe = aiptek_probe,
2181 .disconnect = aiptek_disconnect,
2182 .id_table = aiptek_ids,
2183};
2184
2185/*********************************************************************** 2178/***********************************************************************
2186 * Deal with tablet disconnecting from the system. 2179 * Deal with tablet disconnecting from the system.
2187 */ 2180 */
@@ -2206,6 +2199,13 @@ static void aiptek_disconnect(struct usb_interface *intf)
2206 } 2199 }
2207} 2200}
2208 2201
2202static struct usb_driver aiptek_driver = {
2203 .name = "aiptek",
2204 .probe = aiptek_probe,
2205 .disconnect = aiptek_disconnect,
2206 .id_table = aiptek_ids,
2207};
2208
2209static int __init aiptek_init(void) 2209static int __init aiptek_init(void)
2210{ 2210{
2211 int result = usb_register(&aiptek_driver); 2211 int result = usb_register(&aiptek_driver);
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
652static void atp_disconnect(struct usb_interface *iface) 652static void atp_disconnect(struct usb_interface *iface)
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index b724e36f7b92..a1ae9eea5741 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -772,15 +772,17 @@ static int ati_remote_probe(struct usb_interface *interface, const struct usb_de
772 goto fail3; 772 goto fail3;
773 773
774 /* Set up and register input device */ 774 /* Set up and register input device */
775 input_register_device(ati_remote->idev); 775 err = input_register_device(ati_remote->idev);
776 if (err)
777 goto fail3;
776 778
777 usb_set_intfdata(interface, ati_remote); 779 usb_set_intfdata(interface, ati_remote);
778 return 0; 780 return 0;
779 781
780fail3: usb_kill_urb(ati_remote->irq_urb); 782 fail3: usb_kill_urb(ati_remote->irq_urb);
781 usb_kill_urb(ati_remote->out_urb); 783 usb_kill_urb(ati_remote->out_urb);
782fail2: ati_remote_free_buffers(ati_remote); 784 fail2: ati_remote_free_buffers(ati_remote);
783fail1: input_free_device(input_dev); 785 fail1: input_free_device(input_dev);
784 kfree(ati_remote); 786 kfree(ati_remote);
785 return err; 787 return err;
786} 788}
diff --git a/drivers/usb/input/ati_remote2.c b/drivers/usb/input/ati_remote2.c
index 6459be90599c..5656278d7965 100644
--- a/drivers/usb/input/ati_remote2.c
+++ b/drivers/usb/input/ati_remote2.c
@@ -337,7 +337,7 @@ static void ati_remote2_complete_key(struct urb *urb)
337static int ati_remote2_input_init(struct ati_remote2 *ar2) 337static int ati_remote2_input_init(struct ati_remote2 *ar2)
338{ 338{
339 struct input_dev *idev; 339 struct input_dev *idev;
340 int i; 340 int i, retval;
341 341
342 idev = input_allocate_device(); 342 idev = input_allocate_device();
343 if (!idev) 343 if (!idev)
@@ -364,11 +364,11 @@ static int ati_remote2_input_init(struct ati_remote2 *ar2)
364 usb_to_input_id(ar2->udev, &idev->id); 364 usb_to_input_id(ar2->udev, &idev->id);
365 idev->cdev.dev = &ar2->udev->dev; 365 idev->cdev.dev = &ar2->udev->dev;
366 366
367 i = input_register_device(idev); 367 retval = input_register_device(idev);
368 if (i) 368 if (retval)
369 input_free_device(idev); 369 input_free_device(idev);
370 370
371 return i; 371 return retval;
372} 372}
373 373
374static int ati_remote2_urb_init(struct ati_remote2 *ar2) 374static int ati_remote2_urb_init(struct ati_remote2 *ar2)
diff --git a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c
index fedbcb127c21..64da9876fe56 100644
--- a/drivers/usb/input/kbtab.c
+++ b/drivers/usb/input/kbtab.c
@@ -122,6 +122,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
122 struct usb_endpoint_descriptor *endpoint; 122 struct usb_endpoint_descriptor *endpoint;
123 struct kbtab *kbtab; 123 struct kbtab *kbtab;
124 struct input_dev *input_dev; 124 struct input_dev *input_dev;
125 int error = -ENOMEM;
125 126
126 kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL); 127 kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL);
127 input_dev = input_allocate_device(); 128 input_dev = input_allocate_device();
@@ -168,15 +169,19 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
168 kbtab->irq->transfer_dma = kbtab->data_dma; 169 kbtab->irq->transfer_dma = kbtab->data_dma;
169 kbtab->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 170 kbtab->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
170 171
171 input_register_device(kbtab->dev); 172 error = input_register_device(kbtab->dev);
173 if (error)
174 goto fail3;
172 175
173 usb_set_intfdata(intf, kbtab); 176 usb_set_intfdata(intf, kbtab);
177
174 return 0; 178 return 0;
175 179
176fail2: usb_buffer_free(dev, 10, kbtab->data, kbtab->data_dma); 180 fail3: usb_free_urb(kbtab->irq);
177fail1: input_free_device(input_dev); 181 fail2: usb_buffer_free(dev, 10, kbtab->data, kbtab->data_dma);
182 fail1: input_free_device(input_dev);
178 kfree(kbtab); 183 kfree(kbtab);
179 return -ENOMEM; 184 return error;
180} 185}
181 186
182static void kbtab_disconnect(struct usb_interface *intf) 187static void kbtab_disconnect(struct usb_interface *intf)
diff --git a/drivers/usb/input/keyspan_remote.c b/drivers/usb/input/keyspan_remote.c
index 98bd323369c7..d32a7684de94 100644
--- a/drivers/usb/input/keyspan_remote.c
+++ b/drivers/usb/input/keyspan_remote.c
@@ -437,7 +437,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
437 struct usb_endpoint_descriptor *endpoint; 437 struct usb_endpoint_descriptor *endpoint;
438 struct usb_keyspan *remote; 438 struct usb_keyspan *remote;
439 struct input_dev *input_dev; 439 struct input_dev *input_dev;
440 int i, retval; 440 int i, error;
441 441
442 endpoint = keyspan_get_in_endpoint(interface->cur_altsetting); 442 endpoint = keyspan_get_in_endpoint(interface->cur_altsetting);
443 if (!endpoint) 443 if (!endpoint)
@@ -446,7 +446,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
446 remote = kzalloc(sizeof(*remote), GFP_KERNEL); 446 remote = kzalloc(sizeof(*remote), GFP_KERNEL);
447 input_dev = input_allocate_device(); 447 input_dev = input_allocate_device();
448 if (!remote || !input_dev) { 448 if (!remote || !input_dev) {
449 retval = -ENOMEM; 449 error = -ENOMEM;
450 goto fail1; 450 goto fail1;
451 } 451 }
452 452
@@ -458,19 +458,19 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
458 458
459 remote->in_buffer = usb_buffer_alloc(udev, RECV_SIZE, GFP_ATOMIC, &remote->in_dma); 459 remote->in_buffer = usb_buffer_alloc(udev, RECV_SIZE, GFP_ATOMIC, &remote->in_dma);
460 if (!remote->in_buffer) { 460 if (!remote->in_buffer) {
461 retval = -ENOMEM; 461 error = -ENOMEM;
462 goto fail1; 462 goto fail1;
463 } 463 }
464 464
465 remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL); 465 remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL);
466 if (!remote->irq_urb) { 466 if (!remote->irq_urb) {
467 retval = -ENOMEM; 467 error = -ENOMEM;
468 goto fail2; 468 goto fail2;
469 } 469 }
470 470
471 retval = keyspan_setup(udev); 471 error = keyspan_setup(udev);
472 if (retval) { 472 if (error) {
473 retval = -ENODEV; 473 error = -ENODEV;
474 goto fail3; 474 goto fail3;
475 } 475 }
476 476
@@ -517,7 +517,9 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
517 remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 517 remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
518 518
519 /* we can register the device now, as it is ready */ 519 /* we can register the device now, as it is ready */
520 input_register_device(remote->input); 520 error = input_register_device(remote->input);
521 if (error)
522 goto fail3;
521 523
522 /* save our data pointer in this interface device */ 524 /* save our data pointer in this interface device */
523 usb_set_intfdata(interface, remote); 525 usb_set_intfdata(interface, remote);
@@ -529,7 +531,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
529 fail1: kfree(remote); 531 fail1: kfree(remote);
530 input_free_device(input_dev); 532 input_free_device(input_dev);
531 533
532 return retval; 534 return error;
533} 535}
534 536
535/* 537/*
diff --git a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c
index fea97e5437f8..ce27449dd693 100644
--- a/drivers/usb/input/powermate.c
+++ b/drivers/usb/input/powermate.c
@@ -308,7 +308,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
308 struct powermate_device *pm; 308 struct powermate_device *pm;
309 struct input_dev *input_dev; 309 struct input_dev *input_dev;
310 int pipe, maxp; 310 int pipe, maxp;
311 int err = -ENOMEM; 311 int error = -ENOMEM;
312 312
313 interface = intf->cur_altsetting; 313 interface = intf->cur_altsetting;
314 endpoint = &interface->endpoint[0].desc; 314 endpoint = &interface->endpoint[0].desc;
@@ -387,11 +387,14 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
387 387
388 /* register our interrupt URB with the USB system */ 388 /* register our interrupt URB with the USB system */
389 if (usb_submit_urb(pm->irq, GFP_KERNEL)) { 389 if (usb_submit_urb(pm->irq, GFP_KERNEL)) {
390 err = -EIO; 390 error = -EIO;
391 goto fail4; 391 goto fail4;
392 } 392 }
393 393
394 input_register_device(pm->input); 394 error = input_register_device(pm->input);
395 if (error)
396 goto fail5;
397
395 398
396 /* force an update of everything */ 399 /* force an update of everything */
397 pm->requires_update = UPDATE_PULSE_ASLEEP | UPDATE_PULSE_AWAKE | UPDATE_PULSE_MODE | UPDATE_STATIC_BRIGHTNESS; 400 pm->requires_update = UPDATE_PULSE_ASLEEP | UPDATE_PULSE_AWAKE | UPDATE_PULSE_MODE | UPDATE_STATIC_BRIGHTNESS;
@@ -400,12 +403,13 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
400 usb_set_intfdata(intf, pm); 403 usb_set_intfdata(intf, pm);
401 return 0; 404 return 0;
402 405
403fail4: usb_free_urb(pm->config); 406 fail5: usb_kill_urb(pm->irq);
404fail3: usb_free_urb(pm->irq); 407 fail4: usb_free_urb(pm->config);
405fail2: powermate_free_buffers(udev, pm); 408 fail3: usb_free_urb(pm->irq);
406fail1: input_free_device(input_dev); 409 fail2: powermate_free_buffers(udev, pm);
410 fail1: input_free_device(input_dev);
407 kfree(pm); 411 kfree(pm);
408 return err; 412 return error;
409} 413}
410 414
411/* Called when a USB device we've accepted ownership of is removed */ 415/* Called when a USB device we've accepted ownership of is removed */
diff --git a/drivers/usb/input/wacom_sys.c b/drivers/usb/input/wacom_sys.c
index 12b42746ded8..48988e63ebec 100644
--- a/drivers/usb/input/wacom_sys.c
+++ b/drivers/usb/input/wacom_sys.c
@@ -201,6 +201,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
201 struct wacom *wacom; 201 struct wacom *wacom;
202 struct wacom_wac *wacom_wac; 202 struct wacom_wac *wacom_wac;
203 struct input_dev *input_dev; 203 struct input_dev *input_dev;
204 int error = -ENOMEM;
204 char rep_data[2], limit = 0; 205 char rep_data[2], limit = 0;
205 206
206 wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); 207 wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
@@ -252,7 +253,9 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
252 wacom->irq->transfer_dma = wacom->data_dma; 253 wacom->irq->transfer_dma = wacom->data_dma;
253 wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 254 wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
254 255
255 input_register_device(wacom->dev); 256 error = input_register_device(wacom->dev);
257 if (error)
258 goto fail3;
256 259
257 /* Ask the tablet to report tablet data. Repeat until it succeeds */ 260 /* Ask the tablet to report tablet data. Repeat until it succeeds */
258 do { 261 do {
@@ -265,11 +268,12 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
265 usb_set_intfdata(intf, wacom); 268 usb_set_intfdata(intf, wacom);
266 return 0; 269 return 0;
267 270
268fail2: usb_buffer_free(dev, 10, wacom_wac->data, wacom->data_dma); 271 fail3: usb_free_urb(wacom->irq);
269fail1: input_free_device(input_dev); 272 fail2: usb_buffer_free(dev, 10, wacom_wac->data, wacom->data_dma);
273 fail1: input_free_device(input_dev);
270 kfree(wacom); 274 kfree(wacom);
271 kfree(wacom_wac); 275 kfree(wacom_wac);
272 return -ENOMEM; 276 return error;
273} 277}
274 278
275static void wacom_disconnect(struct usb_interface *intf) 279static void wacom_disconnect(struct usb_interface *intf)
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c
index e4bc76ebc835..ca03d1fc233f 100644
--- a/drivers/usb/input/xpad.c
+++ b/drivers/usb/input/xpad.c
@@ -312,6 +312,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
312 struct input_dev *input_dev; 312 struct input_dev *input_dev;
313 struct usb_endpoint_descriptor *ep_irq_in; 313 struct usb_endpoint_descriptor *ep_irq_in;
314 int i; 314 int i;
315 int error = -ENOMEM;
315 316
316 for (i = 0; xpad_device[i].idVendor; i++) { 317 for (i = 0; xpad_device[i].idVendor; i++) {
317 if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && 318 if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) &&
@@ -373,15 +374,18 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
373 xpad->irq_in->transfer_dma = xpad->idata_dma; 374 xpad->irq_in->transfer_dma = xpad->idata_dma;
374 xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 375 xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
375 376
376 input_register_device(xpad->dev); 377 error = input_register_device(xpad->dev);
378 if (error)
379 goto fail3;
377 380
378 usb_set_intfdata(intf, xpad); 381 usb_set_intfdata(intf, xpad);
379 return 0; 382 return 0;
380 383
381fail2: usb_buffer_free(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma); 384 fail3: usb_free_urb(xpad->irq_in);
382fail1: input_free_device(input_dev); 385 fail2: usb_buffer_free(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma);
386 fail1: input_free_device(input_dev);
383 kfree(xpad); 387 kfree(xpad);
384 return -ENOMEM; 388 return error;
385 389
386} 390}
387 391
diff --git a/drivers/usb/input/yealink.c b/drivers/usb/input/yealink.c
index caff8e6d7448..688abcdf1f0f 100644
--- a/drivers/usb/input/yealink.c
+++ b/drivers/usb/input/yealink.c
@@ -955,7 +955,9 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
955 } 955 }
956 } 956 }
957 957
958 input_register_device(yld->idev); 958 ret = input_register_device(yld->idev);
959 if (ret)
960 return usb_cleanup(yld, ret);
959 961
960 usb_set_intfdata(intf, yld); 962 usb_set_intfdata(intf, yld);
961 963