mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
Input: gamecon - handle errors from input_register_device()
Also gc_remove shouldn't be marked __exit as it is also called from __init code. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
parent
c7fd018d75
commit
77fc46ca5b
1 changed files with 12 additions and 6 deletions
|
@ -706,9 +706,11 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads)
|
||||||
sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i);
|
sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i);
|
||||||
err = gc_setup_pad(gc, i, pads[i]);
|
err = gc_setup_pad(gc, i, pads[i]);
|
||||||
if (err)
|
if (err)
|
||||||
goto err_free_devs;
|
goto err_unreg_devs;
|
||||||
|
|
||||||
input_register_device(gc->dev[i]);
|
err = input_register_device(gc->dev[i]);
|
||||||
|
if (err)
|
||||||
|
goto err_free_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gc->pads[0]) {
|
if (!gc->pads[0]) {
|
||||||
|
@ -720,8 +722,11 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads)
|
||||||
parport_put_port(pp);
|
parport_put_port(pp);
|
||||||
return gc;
|
return gc;
|
||||||
|
|
||||||
err_free_devs:
|
err_free_dev:
|
||||||
|
input_free_device(gc->dev[i]);
|
||||||
|
err_unreg_devs:
|
||||||
while (--i >= 0)
|
while (--i >= 0)
|
||||||
|
if (gc->dev[i])
|
||||||
input_unregister_device(gc->dev[i]);
|
input_unregister_device(gc->dev[i]);
|
||||||
err_free_gc:
|
err_free_gc:
|
||||||
kfree(gc);
|
kfree(gc);
|
||||||
|
@ -733,7 +738,7 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads)
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit gc_remove(struct gc *gc)
|
static void gc_remove(struct gc *gc)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -771,6 +776,7 @@ static int __init gc_init(void)
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
while (--i >= 0)
|
while (--i >= 0)
|
||||||
|
if (gc_base[i])
|
||||||
gc_remove(gc_base[i]);
|
gc_remove(gc_base[i]);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue