diff options
Diffstat (limited to 'drivers/input/keyboard/xtkbd.c')
-rw-r--r-- | drivers/input/keyboard/xtkbd.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c index 8c11dc93545..a8209343213 100644 --- a/drivers/input/keyboard/xtkbd.c +++ b/drivers/input/keyboard/xtkbd.c @@ -95,7 +95,7 @@ static int xtkbd_connect(struct serio *serio, struct serio_driver *drv) xtkbd = kmalloc(sizeof(struct xtkbd), GFP_KERNEL); input_dev = input_allocate_device(); if (!xtkbd || !input_dev) - goto fail; + goto fail1; xtkbd->serio = serio; xtkbd->dev = input_dev; @@ -124,13 +124,17 @@ static int xtkbd_connect(struct serio *serio, struct serio_driver *drv) err = serio_open(serio, drv); if (err) - goto fail; + goto fail2; + + err = input_register_device(xtkbd->dev); + if (err) + goto fail3; - input_register_device(xtkbd->dev); return 0; - fail: serio_set_drvdata(serio, NULL); - input_free_device(input_dev); + fail3: serio_close(serio); + fail2: serio_set_drvdata(serio, NULL); + fail1: input_free_device(input_dev); kfree(xtkbd); return err; } @@ -170,8 +174,7 @@ static struct serio_driver xtkbd_drv = { static int __init xtkbd_init(void) { - serio_register_driver(&xtkbd_drv); - return 0; + return serio_register_driver(&xtkbd_drv); } static void __exit xtkbd_exit(void) |