All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Vernon Mauery <vernux@us.ibm.com>
Cc: kernel list <linux-kernel@vger.kernel.org>,
	Vojtech Pavlik <vojtech@suse.cz>, Max Asbock <amax@us.ibm.com>
Subject: Re: dynamic input_dev allocation for ibmasm driver
Date: Sat, 7 Jan 2006 00:01:32 -0500	[thread overview]
Message-ID: <200601070001.33125.dtor_core@ameritech.net> (raw)
In-Reply-To: <43BF0463.7010700@us.ibm.com>

On Friday 06 January 2006 18:59, Vernon Mauery wrote:
> This patch updates the ibmasm driver to use the dynamic allocation of input_dev
> structs to work with the sysfs subsystem.  I have tested it on my machine and it
> seems to work fine.
> 
> Signed-off-by: Vernon Mauery <vernux@us.ibm.com>
> 
>  ibmasm.h |    6 ++---
>  remote.c |   72 ++++++++++++++++++++++++++++++++++-----------------------------
>  2 files changed, 42 insertions(+), 36 deletions(-)
> 
> 
...
> -	input_register_device(&remote->mouse_dev);
> -	input_register_device(&remote->keybd_dev);
> +	if ((ret = input_register_device(mouse_dev)))
> +		goto error_alloc;
> +	if ((ret = input_register_device(keybd_dev)))
> +		goto error_alloc;
> +
> +	sp->remote.mouse_dev = mouse_dev;
> +	sp->remote.keybd_dev = keybd_dev;
>  	enable_mouse_interrupts(sp);
>  
>  	printk(KERN_INFO "ibmasm remote responding to events on RSA card %d\n", sp->number);
>  
>  	return 0;
> +
> +error_alloc:
> +	input_free_device(mouse_dev);
> +	input_free_device(keybd_dev);
> +	return ret;

Error handling is rotten here. If 2nd input_register_device fails you will
whack fully registered remote->mouse_dev. You are missing call to
input_unregister_device() there.

Please fix it up and send it my way - I'll add it to the input tree.

Thanks!

-- 
Dmitry

  reply	other threads:[~2006-01-07  5:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-06 23:59 dynamic input_dev allocation for ibmasm driver Vernon Mauery
2006-01-07  5:01 ` Dmitry Torokhov [this message]
2006-01-07  9:58   ` Vojtech Pavlik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200601070001.33125.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=amax@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vernux@us.ibm.com \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.