diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 00:18:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 00:18:17 -0500 |
commit | d20e6336ea4250e51081e4b2924b9ef4dfa45909 (patch) | |
tree | 96c22694bec10912d40a3700a945157597dd901b /drivers/input/joystick/turbografx.c | |
parent | fa3c791d85aa9a363dd72dd834b73b79252ef44e (diff) | |
parent | 6dea93477c3377cf4199fd37cc3fb11071987ae4 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
Diffstat (limited to 'drivers/input/joystick/turbografx.c')
-rw-r--r-- | drivers/input/joystick/turbografx.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c index 7e9764937d06..b154938e88a4 100644 --- a/drivers/input/joystick/turbografx.c +++ b/drivers/input/joystick/turbografx.c | |||
@@ -204,14 +204,14 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) | |||
204 | if (n_buttons[i] > 6) { | 204 | if (n_buttons[i] > 6) { |
205 | printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]); | 205 | printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]); |
206 | err = -EINVAL; | 206 | err = -EINVAL; |
207 | goto err_free_devs; | 207 | goto err_unreg_devs; |
208 | } | 208 | } |
209 | 209 | ||
210 | tgfx->dev[i] = input_dev = input_allocate_device(); | 210 | tgfx->dev[i] = input_dev = input_allocate_device(); |
211 | if (!input_dev) { | 211 | if (!input_dev) { |
212 | printk(KERN_ERR "turbografx.c: Not enough memory for input device\n"); | 212 | printk(KERN_ERR "turbografx.c: Not enough memory for input device\n"); |
213 | err = -ENOMEM; | 213 | err = -ENOMEM; |
214 | goto err_free_devs; | 214 | goto err_unreg_devs; |
215 | } | 215 | } |
216 | 216 | ||
217 | tgfx->sticks |= (1 << i); | 217 | tgfx->sticks |= (1 << i); |
@@ -238,7 +238,9 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) | |||
238 | for (j = 0; j < n_buttons[i]; j++) | 238 | for (j = 0; j < n_buttons[i]; j++) |
239 | set_bit(tgfx_buttons[j], input_dev->keybit); | 239 | set_bit(tgfx_buttons[j], input_dev->keybit); |
240 | 240 | ||
241 | input_register_device(tgfx->dev[i]); | 241 | err = input_register_device(tgfx->dev[i]); |
242 | if (err) | ||
243 | goto err_free_dev; | ||
242 | } | 244 | } |
243 | 245 | ||
244 | if (!tgfx->sticks) { | 246 | if (!tgfx->sticks) { |
@@ -249,9 +251,12 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) | |||
249 | 251 | ||
250 | return tgfx; | 252 | return tgfx; |
251 | 253 | ||
252 | err_free_devs: | 254 | err_free_dev: |
255 | input_free_device(tgfx->dev[i]); | ||
256 | err_unreg_devs: | ||
253 | while (--i >= 0) | 257 | while (--i >= 0) |
254 | input_unregister_device(tgfx->dev[i]); | 258 | if (tgfx->dev[i]) |
259 | input_unregister_device(tgfx->dev[i]); | ||
255 | err_free_tgfx: | 260 | err_free_tgfx: |
256 | kfree(tgfx); | 261 | kfree(tgfx); |
257 | err_unreg_pardev: | 262 | err_unreg_pardev: |
@@ -262,7 +267,7 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) | |||
262 | return ERR_PTR(err); | 267 | return ERR_PTR(err); |
263 | } | 268 | } |
264 | 269 | ||
265 | static void __exit tgfx_remove(struct tgfx *tgfx) | 270 | static void tgfx_remove(struct tgfx *tgfx) |
266 | { | 271 | { |
267 | int i; | 272 | int i; |
268 | 273 | ||
@@ -300,7 +305,8 @@ static int __init tgfx_init(void) | |||
300 | 305 | ||
301 | if (err) { | 306 | if (err) { |
302 | while (--i >= 0) | 307 | while (--i >= 0) |
303 | tgfx_remove(tgfx_base[i]); | 308 | if (tgfx_base[i]) |
309 | tgfx_remove(tgfx_base[i]); | ||
304 | return err; | 310 | return err; |
305 | } | 311 | } |
306 | 312 | ||