Input: joysticks - handle errors when registering input devices

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
Dmitry Torokhov
2006-11-05 22:40:09 -05:00
parent 52c1f5704d
commit 127278ce22
16 changed files with 120 additions and 59 deletions

View File

@@ -521,11 +521,19 @@ static int adi_connect(struct gameport *gameport, struct gameport_driver *drv)
for (i = 0; i < 2; i++)
if (port->adi[i].length > 0) {
adi_init_center(port->adi + i);
input_register_device(port->adi[i].dev);
err = input_register_device(port->adi[i].dev);
if (err)
goto fail3;
}
return 0;
fail3: while (--i >= 0) {
if (port->adi[i].length > 0) {
input_unregister_device(port->adi[i].dev);
port->adi[i].dev = NULL;
}
}
fail2: for (i = 0; i < 2; i++)
if (port->adi[i].dev)
input_free_device(port->adi[i].dev);