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/xtkbd.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/xtkbd.c')
-rw-r--r-- | drivers/input/keyboard/xtkbd.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c index 8c11dc935454..b53f71638583 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) | |||
95 | xtkbd = kmalloc(sizeof(struct xtkbd), GFP_KERNEL); | 95 | xtkbd = kmalloc(sizeof(struct xtkbd), GFP_KERNEL); |
96 | input_dev = input_allocate_device(); | 96 | input_dev = input_allocate_device(); |
97 | if (!xtkbd || !input_dev) | 97 | if (!xtkbd || !input_dev) |
98 | goto fail; | 98 | goto fail1; |
99 | 99 | ||
100 | xtkbd->serio = serio; | 100 | xtkbd->serio = serio; |
101 | xtkbd->dev = input_dev; | 101 | xtkbd->dev = input_dev; |
@@ -124,13 +124,17 @@ static int xtkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
124 | 124 | ||
125 | err = serio_open(serio, drv); | 125 | err = serio_open(serio, drv); |
126 | if (err) | 126 | if (err) |
127 | goto fail; | 127 | goto fail2; |
128 | |||
129 | err = input_register_device(xtkbd->dev); | ||
130 | if (err) | ||
131 | goto fail3; | ||
128 | 132 | ||
129 | input_register_device(xtkbd->dev); | ||
130 | return 0; | 133 | return 0; |
131 | 134 | ||
132 | fail: serio_set_drvdata(serio, NULL); | 135 | fail3: serio_close(serio); |
133 | input_free_device(input_dev); | 136 | fail2: serio_set_drvdata(serio, NULL); |
137 | fail1: input_free_device(input_dev); | ||
134 | kfree(xtkbd); | 138 | kfree(xtkbd); |
135 | return err; | 139 | return err; |
136 | } | 140 | } |