diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-05 22:40:09 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-05 22:40:09 -0500 |
commit | 127278ce2254c61f1346500374d61e33f74a8729 (patch) | |
tree | f7460f3f452d3dbe2d7a52dfa23a51dee0d312f3 /drivers/input/joystick/stinger.c | |
parent | 52c1f5704d7555a16641429b2e7af5d26d7b119a (diff) |
Input: joysticks - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joystick/stinger.c')
-rw-r--r-- | drivers/input/joystick/stinger.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/input/joystick/stinger.c b/drivers/input/joystick/stinger.c index 1ffb03223311..b51a4a4c7f60 100644 --- a/drivers/input/joystick/stinger.c +++ b/drivers/input/joystick/stinger.c | |||
@@ -143,7 +143,7 @@ static int stinger_connect(struct serio *serio, struct serio_driver *drv) | |||
143 | stinger = kmalloc(sizeof(struct stinger), GFP_KERNEL); | 143 | stinger = kmalloc(sizeof(struct stinger), GFP_KERNEL); |
144 | input_dev = input_allocate_device(); | 144 | input_dev = input_allocate_device(); |
145 | if (!stinger || !input_dev) | 145 | if (!stinger || !input_dev) |
146 | goto fail; | 146 | goto fail1; |
147 | 147 | ||
148 | stinger->dev = input_dev; | 148 | stinger->dev = input_dev; |
149 | snprintf(stinger->phys, sizeof(stinger->phys), "%s/serio0", serio->phys); | 149 | snprintf(stinger->phys, sizeof(stinger->phys), "%s/serio0", serio->phys); |
@@ -168,13 +168,17 @@ static int stinger_connect(struct serio *serio, struct serio_driver *drv) | |||
168 | 168 | ||
169 | err = serio_open(serio, drv); | 169 | err = serio_open(serio, drv); |
170 | if (err) | 170 | if (err) |
171 | goto fail; | 171 | goto fail2; |
172 | |||
173 | err = input_register_device(stinger->dev); | ||
174 | if (err) | ||
175 | goto fail3; | ||
172 | 176 | ||
173 | input_register_device(stinger->dev); | ||
174 | return 0; | 177 | return 0; |
175 | 178 | ||
176 | fail: serio_set_drvdata(serio, NULL); | 179 | fail3: serio_close(serio); |
177 | input_free_device(input_dev); | 180 | fail2: serio_set_drvdata(serio, NULL); |
181 | fail1: input_free_device(input_dev); | ||
178 | kfree(stinger); | 182 | kfree(stinger); |
179 | return err; | 183 | return err; |
180 | } | 184 | } |