diff options
Diffstat (limited to 'drivers/input/joystick/spaceorb.c')
-rw-r--r-- | drivers/input/joystick/spaceorb.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c index c4db0247c5f..c9c79211af7 100644 --- a/drivers/input/joystick/spaceorb.c +++ b/drivers/input/joystick/spaceorb.c @@ -172,7 +172,7 @@ static int spaceorb_connect(struct serio *serio, struct serio_driver *drv) spaceorb = kzalloc(sizeof(struct spaceorb), GFP_KERNEL); input_dev = input_allocate_device(); if (!spaceorb || !input_dev) - goto fail; + goto fail1; spaceorb->dev = input_dev; snprintf(spaceorb->phys, sizeof(spaceorb->phys), "%s/input0", serio->phys); @@ -198,13 +198,17 @@ static int spaceorb_connect(struct serio *serio, struct serio_driver *drv) err = serio_open(serio, drv); if (err) - goto fail; + goto fail2; + + err = input_register_device(spaceorb->dev); + if (err) + goto fail3; - input_register_device(spaceorb->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(spaceorb); return err; } @@ -242,8 +246,7 @@ static struct serio_driver spaceorb_drv = { static int __init spaceorb_init(void) { - serio_register_driver(&spaceorb_drv); - return 0; + return serio_register_driver(&spaceorb_drv); } static void __exit spaceorb_exit(void) |