aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input/powermate.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/powermate.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/powermate.c')
-rw-r--r--drivers/usb/input/powermate.c20
1 files changed, 12 insertions, 8 deletions
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 */