Input: USB devices - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index b724e36..a1ae9ee 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -772,15 +772,17 @@
goto fail3;
/* Set up and register input device */
- input_register_device(ati_remote->idev);
+ err = input_register_device(ati_remote->idev);
+ if (err)
+ goto fail3;
usb_set_intfdata(interface, ati_remote);
return 0;
-fail3: usb_kill_urb(ati_remote->irq_urb);
+ fail3: usb_kill_urb(ati_remote->irq_urb);
usb_kill_urb(ati_remote->out_urb);
-fail2: ati_remote_free_buffers(ati_remote);
-fail1: input_free_device(input_dev);
+ fail2: ati_remote_free_buffers(ati_remote);
+ fail1: input_free_device(input_dev);
kfree(ati_remote);
return err;
}