aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/joystick/spaceball.c
diff options
context:
space:
mode:
authorGravatar Dmitry Torokhov <dtor@insightbb.com> 2006-11-05 22:40:09 -0500
committerGravatar Dmitry Torokhov <dtor@insightbb.com> 2006-11-05 22:40:09 -0500
commit127278ce2254c61f1346500374d61e33f74a8729 (patch)
treef7460f3f452d3dbe2d7a52dfa23a51dee0d312f3 /drivers/input/joystick/spaceball.c
parentInput: touchscreens - handle errors when registering input devices (diff)
downloadlinux-127278ce2254c61f1346500374d61e33f74a8729.tar.gz
linux-127278ce2254c61f1346500374d61e33f74a8729.tar.bz2
linux-127278ce2254c61f1346500374d61e33f74a8729.zip
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.c14
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)
spaceball = kmalloc(sizeof(struct spaceball), GFP_KERNEL);
input_dev = input_allocate_device();
if (!spaceball || !input_dev)
- goto fail;
+ goto fail1;
spaceball->dev = input_dev;
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)
err = serio_open(serio, drv);
if (err)
- goto fail;
+ goto fail2;
+
+ err = input_register_device(spaceball->dev);
+ if (err)
+ goto fail3;
- input_register_device(spaceball->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(spaceball);
return err;
}