lkml.org 
[lkml]   [2006]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 24/24] ibmasm: convert to dynamic input_dev allocation
    Dmitry Torokhov wrote:
    > From: Vernon Mauery <vernux@us.ibm.com>,
    >
    > Input: ibmasm - convert to dynamic input_dev allocation
    >
    > Update the ibmasm driver to use the dynamic allocation of input_dev
    > structs to work with the sysfs subsystem.
    >
    > Vojtech: Fixed some problems/bugs in the patch.
    > Dmitry: Fixed some more.
    >
    > Signed-off-by: Vernon Mauery <vernux@us.ibm.com>
    > Signed-off-by: Vojtech Pavlik <vojtech@suse.cz>
    > Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
    > ---
    >
    > drivers/misc/ibmasm/ibmasm.h | 6 +--
    > drivers/misc/ibmasm/remote.c | 82 +++++++++++++++++++++++++------------------
    > 2 files changed, 51 insertions(+), 37 deletions(-)
    >

    > Index: work/drivers/misc/ibmasm/remote.c
    > ===================================================================
    > --- work.orig/drivers/misc/ibmasm/remote.c
    > +++ work/drivers/misc/ibmasm/remote.c

    [snip]

    >
    > - input_register_device(&remote->mouse_dev);
    > - input_register_device(&remote->keybd_dev);
    > + error = input_register_device(mouse_dev);
    > + if (error)
    > + goto err_free_devices;
    > +
    > + error = input_register_device(keybd_dev);
    > + if (error)
    > + goto err_unregister_mouse_dev;
    > +
    > enable_mouse_interrupts(sp);
    >
    > printk(KERN_INFO "ibmasm remote responding to events on RSA card %d\n", sp->number);
    >
    > return 0;
    > +
    > + err_unregister_mouse_dev:
    > + input_unregister_device(mouse_dev);

    If I understand the API correctly now, shouldn't there be a
    mouse_dev = NULL;
    right here to prevent the following input_free_device?

    --Vernon

    > + err_free_devices:
    > + input_free_device(mouse_dev);
    > + input_free_device(keybd_dev);
    > +
    > + return error;
    > }
    >
    > void ibmasm_free_remote_input_dev(struct service_processor *sp)
    > {
    > disable_mouse_interrupts(sp);
    > - input_unregister_device(&sp->remote->keybd_dev);
    > - input_unregister_device(&sp->remote->mouse_dev);
    > - kfree(sp->remote);
    > + input_unregister_device(sp->remote.mouse_dev);
    > + input_unregister_device(sp->remote.keybd_dev);
    > }
    >
    >
    > -
    > 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/
    >
    >

    -
    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-01-09 19:25    [W:7.655 / U:0.060 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site