summaryrefslogtreecommitdiff
path: root/drivers/input/joystick/magellan.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:09 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:09 -0500
commit127278ce2254c61f1346500374d61e33f74a8729 (patch)
treef7460f3f452d3dbe2d7a52dfa23a51dee0d312f3 /drivers/input/joystick/magellan.c
parent52c1f5704d7555a16641429b2e7af5d26d7b119a (diff)
Input: joysticks - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joystick/magellan.c')
-rw-r--r--drivers/input/joystick/magellan.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c
index e3d19444ba2e..d512b0a0282e 100644
--- a/drivers/input/joystick/magellan.c
+++ b/drivers/input/joystick/magellan.c
@@ -157,7 +157,7 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
magellan = kzalloc(sizeof(struct magellan), GFP_KERNEL);
input_dev = input_allocate_device();
if (!magellan || !input_dev)
- goto fail;
+ goto fail1;
magellan->dev = input_dev;
snprintf(magellan->phys, sizeof(magellan->phys), "%s/input0", serio->phys);
@@ -183,13 +183,17 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
err = serio_open(serio, drv);
if (err)
- goto fail;
+ goto fail2;
+
+ err = input_register_device(magellan->dev);
+ if (err)
+ goto fail3;
- input_register_device(magellan->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(magellan);
return err;
}