diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-05 22:39:56 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-05 22:39:56 -0500 |
commit | 2b03b60e6b8635fffdd15d5d24943950f2bbf96e (patch) | |
tree | 17f0354b7edb08920a89e663ef724c84518c49fa /drivers/input/keyboard/lkkbd.c | |
parent | 41ad5fbabda0c3930136bb40cfc7a0c23013365f (diff) |
Input: keyboards - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard/lkkbd.c')
-rw-r--r-- | drivers/input/keyboard/lkkbd.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c index 708d5a1bc3d2..0067c1fe3d4e 100644 --- a/drivers/input/keyboard/lkkbd.c +++ b/drivers/input/keyboard/lkkbd.c | |||
@@ -651,7 +651,7 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv) | |||
651 | input_dev = input_allocate_device (); | 651 | input_dev = input_allocate_device (); |
652 | if (!lk || !input_dev) { | 652 | if (!lk || !input_dev) { |
653 | err = -ENOMEM; | 653 | err = -ENOMEM; |
654 | goto fail; | 654 | goto fail1; |
655 | } | 655 | } |
656 | 656 | ||
657 | lk->serio = serio; | 657 | lk->serio = serio; |
@@ -696,15 +696,19 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv) | |||
696 | 696 | ||
697 | err = serio_open (serio, drv); | 697 | err = serio_open (serio, drv); |
698 | if (err) | 698 | if (err) |
699 | goto fail; | 699 | goto fail2; |
700 | |||
701 | err = input_register_device (lk->dev); | ||
702 | if (err) | ||
703 | goto fail3; | ||
700 | 704 | ||
701 | input_register_device (lk->dev); | ||
702 | lk->serio->write (lk->serio, LK_CMD_POWERCYCLE_RESET); | 705 | lk->serio->write (lk->serio, LK_CMD_POWERCYCLE_RESET); |
703 | 706 | ||
704 | return 0; | 707 | return 0; |
705 | 708 | ||
706 | fail: serio_set_drvdata (serio, NULL); | 709 | fail3: serio_close (serio); |
707 | input_free_device (input_dev); | 710 | fail2: serio_set_drvdata (serio, NULL); |
711 | fail1: input_free_device (input_dev); | ||
708 | kfree (lk); | 712 | kfree (lk); |
709 | return err; | 713 | return err; |
710 | } | 714 | } |