summaryrefslogtreecommitdiff
path: root/drivers/input/keyboard/xtkbd.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:39:56 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:39:56 -0500
commit2b03b60e6b8635fffdd15d5d24943950f2bbf96e (patch)
tree17f0354b7edb08920a89e663ef724c84518c49fa /drivers/input/keyboard/xtkbd.c
parent41ad5fbabda0c3930136bb40cfc7a0c23013365f (diff)
downloadlinux-3.10-2b03b60e6b8635fffdd15d5d24943950f2bbf96e.tar.gz
linux-3.10-2b03b60e6b8635fffdd15d5d24943950f2bbf96e.tar.bz2
linux-3.10-2b03b60e6b8635fffdd15d5d24943950f2bbf96e.zip
Input: keyboards - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard/xtkbd.c')
-rw-r--r--drivers/input/keyboard/xtkbd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c
index 8c11dc93545..b53f7163858 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;
}