aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joystick/adi.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:09 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:09 -0500
commit127278ce2254c61f1346500374d61e33f74a8729 (patch)
treef7460f3f452d3dbe2d7a52dfa23a51dee0d312f3 /drivers/input/joystick/adi.c
parent52c1f5704d7555a16641429b2e7af5d26d7b119a (diff)
Input: joysticks - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joystick/adi.c')
-rw-r--r--drivers/input/joystick/adi.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c
index 704bf70f1db7..6279ced8a35b 100644
--- a/drivers/input/joystick/adi.c
+++ b/drivers/input/joystick/adi.c
@@ -521,11 +521,19 @@ static int adi_connect(struct gameport *gameport, struct gameport_driver *drv)
521 for (i = 0; i < 2; i++) 521 for (i = 0; i < 2; i++)
522 if (port->adi[i].length > 0) { 522 if (port->adi[i].length > 0) {
523 adi_init_center(port->adi + i); 523 adi_init_center(port->adi + i);
524 input_register_device(port->adi[i].dev); 524 err = input_register_device(port->adi[i].dev);
525 if (err)
526 goto fail3;
525 } 527 }
526 528
527 return 0; 529 return 0;
528 530
531 fail3: while (--i >= 0) {
532 if (port->adi[i].length > 0) {
533 input_unregister_device(port->adi[i].dev);
534 port->adi[i].dev = NULL;
535 }
536 }
529 fail2: for (i = 0; i < 2; i++) 537 fail2: for (i = 0; i < 2; i++)
530 if (port->adi[i].dev) 538 if (port->adi[i].dev)
531 input_free_device(port->adi[i].dev); 539 input_free_device(port->adi[i].dev);