aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input/keyspan_remote.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2007-04-12 01:33:39 -0400
committerDmitry Torokhov <dtor@insightbb.com>2007-04-12 01:33:39 -0400
commit5014186de89708d0e9eed60526b698d5b786b707 (patch)
tree949ea6219db7779f635a34278325bd2d9617c657 /drivers/usb/input/keyspan_remote.c
parentdb61a9124880a1d79b7b320d4b6bef717f23e485 (diff)
Input: USB devices - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/usb/input/keyspan_remote.c')
-rw-r--r--drivers/usb/input/keyspan_remote.c20
1 files changed, 11 insertions, 9 deletions
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/*