diff options
Diffstat (limited to 'drivers/input/joystick/warrior.c')
-rw-r--r-- | drivers/input/joystick/warrior.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c index 35edea1ab955..1e4828b9a1ab 100644 --- a/drivers/input/joystick/warrior.c +++ b/drivers/input/joystick/warrior.c | |||
@@ -149,7 +149,7 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv) | |||
149 | warrior = kzalloc(sizeof(struct warrior), GFP_KERNEL); | 149 | warrior = kzalloc(sizeof(struct warrior), GFP_KERNEL); |
150 | input_dev = input_allocate_device(); | 150 | input_dev = input_allocate_device(); |
151 | if (!warrior || !input_dev) | 151 | if (!warrior || !input_dev) |
152 | goto fail; | 152 | goto fail1; |
153 | 153 | ||
154 | warrior->dev = input_dev; | 154 | warrior->dev = input_dev; |
155 | snprintf(warrior->phys, sizeof(warrior->phys), "%s/input0", serio->phys); | 155 | snprintf(warrior->phys, sizeof(warrior->phys), "%s/input0", serio->phys); |
@@ -176,13 +176,17 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv) | |||
176 | 176 | ||
177 | err = serio_open(serio, drv); | 177 | err = serio_open(serio, drv); |
178 | if (err) | 178 | if (err) |
179 | goto fail; | 179 | goto fail2; |
180 | |||
181 | err = input_register_device(warrior->dev); | ||
182 | if (err) | ||
183 | goto fail3; | ||
180 | 184 | ||
181 | input_register_device(warrior->dev); | ||
182 | return 0; | 185 | return 0; |
183 | 186 | ||
184 | fail: serio_set_drvdata(serio, NULL); | 187 | fail3: serio_close(serio); |
185 | input_free_device(input_dev); | 188 | fail2: serio_set_drvdata(serio, NULL); |
189 | fail1: input_free_device(input_dev); | ||
186 | kfree(warrior); | 190 | kfree(warrior); |
187 | return err; | 191 | return err; |
188 | } | 192 | } |