diff options
Diffstat (limited to 'drivers/input/joystick/spaceorb.c')
-rw-r--r-- | drivers/input/joystick/spaceorb.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c index c4db0247c5fb..ea9d51e70a12 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) | |||
172 | spaceorb = kzalloc(sizeof(struct spaceorb), GFP_KERNEL); | 172 | spaceorb = kzalloc(sizeof(struct spaceorb), GFP_KERNEL); |
173 | input_dev = input_allocate_device(); | 173 | input_dev = input_allocate_device(); |
174 | if (!spaceorb || !input_dev) | 174 | if (!spaceorb || !input_dev) |
175 | goto fail; | 175 | goto fail1; |
176 | 176 | ||
177 | spaceorb->dev = input_dev; | 177 | spaceorb->dev = input_dev; |
178 | snprintf(spaceorb->phys, sizeof(spaceorb->phys), "%s/input0", serio->phys); | 178 | 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) | |||
198 | 198 | ||
199 | err = serio_open(serio, drv); | 199 | err = serio_open(serio, drv); |
200 | if (err) | 200 | if (err) |
201 | goto fail; | 201 | goto fail2; |
202 | |||
203 | err = input_register_device(spaceorb->dev); | ||
204 | if (err) | ||
205 | goto fail3; | ||
202 | 206 | ||
203 | input_register_device(spaceorb->dev); | ||
204 | return 0; | 207 | return 0; |
205 | 208 | ||
206 | fail: serio_set_drvdata(serio, NULL); | 209 | fail3: serio_close(serio); |
207 | input_free_device(input_dev); | 210 | fail2: serio_set_drvdata(serio, NULL); |
211 | fail1: input_free_device(input_dev); | ||
208 | kfree(spaceorb); | 212 | kfree(spaceorb); |
209 | return err; | 213 | return err; |
210 | } | 214 | } |