diff options
Diffstat (limited to 'drivers/input/keyboard/lkkbd.c')
-rw-r--r-- | drivers/input/keyboard/lkkbd.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c index b7f049b45b6..3d4d0a0ede2 100644 --- a/drivers/input/keyboard/lkkbd.c +++ b/drivers/input/keyboard/lkkbd.c @@ -646,7 +646,7 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv) input_dev = input_allocate_device (); if (!lk || !input_dev) { err = -ENOMEM; - goto fail; + goto fail1; } lk->serio = serio; @@ -691,15 +691,19 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv) err = serio_open (serio, drv); if (err) - goto fail; + goto fail2; + + err = input_register_device (lk->dev); + if (err) + goto fail3; - input_register_device (lk->dev); lk->serio->write (lk->serio, LK_CMD_POWERCYCLE_RESET); 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 (lk); return err; } @@ -749,8 +753,7 @@ static struct serio_driver lkkbd_drv = { static int __init lkkbd_init (void) { - serio_register_driver(&lkkbd_drv); - return 0; + return serio_register_driver(&lkkbd_drv); } static void __exit |