diff options
| author | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-01-29 21:52:11 -0500 |
|---|---|---|
| committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2006-01-29 21:52:11 -0500 |
| commit | 77fc46ca5b331df3fc0ffef24012ba0d51d601b3 (patch) | |
| tree | 3d278172f3931e69bca1714d5418121151ca07c0 /drivers/input | |
| parent | c7fd018d75cae2b0c1cf03003b38f4c76e3df826 (diff) | |
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>
Diffstat (limited to 'drivers/input')
| -rw-r--r-- | drivers/input/joystick/gamecon.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c index d9757452c93a..900587acdb47 100644 --- a/drivers/input/joystick/gamecon.c +++ b/drivers/input/joystick/gamecon.c | |||
| @@ -706,9 +706,11 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads) | |||
| 706 | sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i); | 706 | sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i); |
| 707 | err = gc_setup_pad(gc, i, pads[i]); | 707 | err = gc_setup_pad(gc, i, pads[i]); |
| 708 | if (err) | 708 | if (err) |
| 709 | goto err_free_devs; | 709 | goto err_unreg_devs; |
| 710 | 710 | ||
| 711 | input_register_device(gc->dev[i]); | 711 | err = input_register_device(gc->dev[i]); |
| 712 | if (err) | ||
| 713 | goto err_free_dev; | ||
| 712 | } | 714 | } |
| 713 | 715 | ||
| 714 | if (!gc->pads[0]) { | 716 | if (!gc->pads[0]) { |
| @@ -720,9 +722,12 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads) | |||
| 720 | parport_put_port(pp); | 722 | parport_put_port(pp); |
| 721 | return gc; | 723 | return gc; |
| 722 | 724 | ||
| 723 | err_free_devs: | 725 | err_free_dev: |
| 726 | input_free_device(gc->dev[i]); | ||
| 727 | err_unreg_devs: | ||
| 724 | while (--i >= 0) | 728 | while (--i >= 0) |
| 725 | input_unregister_device(gc->dev[i]); | 729 | if (gc->dev[i]) |
| 730 | input_unregister_device(gc->dev[i]); | ||
| 726 | err_free_gc: | 731 | err_free_gc: |
| 727 | kfree(gc); | 732 | kfree(gc); |
| 728 | err_unreg_pardev: | 733 | err_unreg_pardev: |
| @@ -733,7 +738,7 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads) | |||
| 733 | return ERR_PTR(err); | 738 | return ERR_PTR(err); |
| 734 | } | 739 | } |
| 735 | 740 | ||
| 736 | static void __exit gc_remove(struct gc *gc) | 741 | static void gc_remove(struct gc *gc) |
| 737 | { | 742 | { |
| 738 | int i; | 743 | int i; |
| 739 | 744 | ||
| @@ -771,7 +776,8 @@ static int __init gc_init(void) | |||
| 771 | 776 | ||
| 772 | if (err) { | 777 | if (err) { |
| 773 | while (--i >= 0) | 778 | while (--i >= 0) |
| 774 | gc_remove(gc_base[i]); | 779 | if (gc_base[i]) |
| 780 | gc_remove(gc_base[i]); | ||
| 775 | return err; | 781 | return err; |
| 776 | } | 782 | } |
| 777 | 783 | ||
