lkml.org 
[lkml]   [2006]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[GIT PATCH 13/18] gamecon: handle errors from input_register_device()
    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>
    ---

    drivers/input/joystick/gamecon.c | 18 ++++++++++++------
    1 files changed, 12 insertions(+), 6 deletions(-)

    Index: work/drivers/input/joystick/gamecon.c
    ===================================================================
    --- work.orig/drivers/input/joystick/gamecon.c
    +++ work/drivers/input/joystick/gamecon.c
    @@ -706,9 +706,11 @@ static struct gc __init *gc_probe(int pa
    sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i);
    err = gc_setup_pad(gc, i, pads[i]);
    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]) {
    @@ -720,9 +722,12 @@ static struct gc __init *gc_probe(int pa
    parport_put_port(pp);
    return gc;

    - err_free_devs:
    + err_free_dev:
    + input_free_device(gc->dev[i]);
    + err_unreg_devs:
    while (--i >= 0)
    - input_unregister_device(gc->dev[i]);
    + if (gc->dev[i])
    + input_unregister_device(gc->dev[i]);
    err_free_gc:
    kfree(gc);
    err_unreg_pardev:
    @@ -733,7 +738,7 @@ static struct gc __init *gc_probe(int pa
    return ERR_PTR(err);
    }

    -static void __exit gc_remove(struct gc *gc)
    +static void gc_remove(struct gc *gc)
    {
    int i;

    @@ -771,7 +776,8 @@ static int __init gc_init(void)

    if (err) {
    while (--i >= 0)
    - gc_remove(gc_base[i]);
    + if (gc_base[i])
    + gc_remove(gc_base[i]);
    return err;
    }

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-02-01 06:16    [W:5.003 / U:0.304 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site