diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-05 22:40:09 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-05 22:40:09 -0500 |
commit | 127278ce2254c61f1346500374d61e33f74a8729 (patch) | |
tree | f7460f3f452d3dbe2d7a52dfa23a51dee0d312f3 /drivers/input/joystick/spaceball.c | |
parent | 52c1f5704d7555a16641429b2e7af5d26d7b119a (diff) |
Input: joysticks - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joystick/spaceball.c')
-rw-r--r-- | drivers/input/joystick/spaceball.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c index 2a9808cf826f..9b3597343c1c 100644 --- a/drivers/input/joystick/spaceball.c +++ b/drivers/input/joystick/spaceball.c | |||
@@ -215,7 +215,7 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv) | |||
215 | spaceball = kmalloc(sizeof(struct spaceball), GFP_KERNEL); | 215 | spaceball = kmalloc(sizeof(struct spaceball), GFP_KERNEL); |
216 | input_dev = input_allocate_device(); | 216 | input_dev = input_allocate_device(); |
217 | if (!spaceball || !input_dev) | 217 | if (!spaceball || !input_dev) |
218 | goto fail; | 218 | goto fail1; |
219 | 219 | ||
220 | spaceball->dev = input_dev; | 220 | spaceball->dev = input_dev; |
221 | snprintf(spaceball->phys, sizeof(spaceball->phys), "%s/input0", serio->phys); | 221 | snprintf(spaceball->phys, sizeof(spaceball->phys), "%s/input0", serio->phys); |
@@ -252,13 +252,17 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv) | |||
252 | 252 | ||
253 | err = serio_open(serio, drv); | 253 | err = serio_open(serio, drv); |
254 | if (err) | 254 | if (err) |
255 | goto fail; | 255 | goto fail2; |
256 | |||
257 | err = input_register_device(spaceball->dev); | ||
258 | if (err) | ||
259 | goto fail3; | ||
256 | 260 | ||
257 | input_register_device(spaceball->dev); | ||
258 | return 0; | 261 | return 0; |
259 | 262 | ||
260 | fail: serio_set_drvdata(serio, NULL); | 263 | fail3: serio_close(serio); |
261 | input_free_device(input_dev); | 264 | fail2: serio_set_drvdata(serio, NULL); |
265 | fail1: input_free_device(input_dev); | ||
262 | kfree(spaceball); | 266 | kfree(spaceball); |
263 | return err; | 267 | return err; |
264 | } | 268 | } |