aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/usbhid/usbkbd.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@mail.ru>2007-04-04 04:40:57 -0400
committerJiri Kosina <jkosina@suse.cz>2007-04-11 04:36:03 -0400
commit5d6341c606b9eb62fbaa7b2a0da82ac851bf0fc4 (patch)
tree5ab2882f7b524ba20dab60957ab2d8176fc9890c /drivers/hid/usbhid/usbkbd.c
parent66df514b1dbf51a0a02a8abe1219e46e49710aea (diff)
USB HID: usbkbd/usbmouse - handle errors when registering devices
Handle errors when registering input devices in usbkbd/usbmouse. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/usbhid/usbkbd.c')
-rw-r--r--drivers/hid/usbhid/usbkbd.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
index 3749f4a235f9..65aa12e8d7b3 100644
--- a/drivers/hid/usbhid/usbkbd.c
+++ b/drivers/hid/usbhid/usbkbd.c
@@ -228,6 +228,7 @@ static int usb_kbd_probe(struct usb_interface *iface,
228 struct usb_kbd *kbd; 228 struct usb_kbd *kbd;
229 struct input_dev *input_dev; 229 struct input_dev *input_dev;
230 int i, pipe, maxp; 230 int i, pipe, maxp;
231 int error = -ENOMEM;
231 232
232 interface = iface->cur_altsetting; 233 interface = iface->cur_altsetting;
233 234
@@ -306,15 +307,19 @@ static int usb_kbd_probe(struct usb_interface *iface,
306 kbd->led->transfer_dma = kbd->leds_dma; 307 kbd->led->transfer_dma = kbd->leds_dma;
307 kbd->led->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); 308 kbd->led->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP);
308 309
309 input_register_device(kbd->dev); 310 error = input_register_device(kbd->dev);
311 if (error)
312 goto fail2;
310 313
311 usb_set_intfdata(iface, kbd); 314 usb_set_intfdata(iface, kbd);
312 return 0; 315 return 0;
313 316
314fail2: usb_kbd_free_mem(dev, kbd); 317fail2:
315fail1: input_free_device(input_dev); 318 usb_kbd_free_mem(dev, kbd);
319fail1:
320 input_free_device(input_dev);
316 kfree(kbd); 321 kfree(kbd);
317 return -ENOMEM; 322 return error;
318} 323}
319 324
320static void usb_kbd_disconnect(struct usb_interface *intf) 325static void usb_kbd_disconnect(struct usb_interface *intf)