Re: [PATCH 24/24] ibmasm: convert to dynamic input_dev allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dmitry Torokhov wrote:
> From: Vernon Mauery <[email protected]>,
> 
> 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 <[email protected]>
> Signed-off-by: Vojtech Pavlik <[email protected]>
> Signed-off-by: Dmitry Torokhov <[email protected]>
> ---
> 
>  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 [email protected]
> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux