public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: Axel Lin <axel.lin@gmail.com>
Cc: "linux-kernel" <linux-kernel@vger.kernel.org>,
	Matthew Garrett <mjg@redhat.com>, Len Brown <len.brown@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Frans Pop <elendil@planet.nl>, Anisse Astier <anisse@astier.eu>,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH] hp-wmi: add return value checking for input_allocate_device()
Date: Tue, 6 Jul 2010 09:56:45 +0200	[thread overview]
Message-ID: <201007060956.45726.trenn@suse.de> (raw)
In-Reply-To: <1278383426.12801.15.camel@mola>

Hi,

it's incredible how much cleanups and fixes you find in this
handful of drivers... It's very much appreciated!

On Tuesday 06 July 2010 04:30:26 Axel Lin wrote:
> Add error checking and return -ENOMEM if input_allocate_device() fail.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/platform/x86/hp-wmi.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> index 51c07a0..c508e20 100644
> --- a/drivers/platform/x86/hp-wmi.c
> +++ b/drivers/platform/x86/hp-wmi.c
> @@ -402,6 +402,8 @@ static int __init hp_wmi_input_setup(void)
>  	int err;
>  
>  	hp_wmi_input_dev = input_allocate_device();
> +	if (!hp_wmi_input_dev)
> +		return -ENOMEM;
>  
>  	hp_wmi_input_dev->name = "HP WMI hotkeys";
>  	hp_wmi_input_dev->phys = "wmi/input0";
But also hp_wmi_input_setup() call should get checked and if it
fails, the previous wmi_install_notify_handler() must get uninstalled
again. Hm, probably the whole driver shouldn't load then and
the error code from hp_wmi_input_setup() can be returned in
hp_wmi_init(void).

Do you mind to incorporate above if you agree.

Thanks,

   Thomas

  reply	other threads:[~2010-07-06  7:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-06  2:30 [PATCH] hp-wmi: add return value checking for input_allocate_device() Axel Lin
2010-07-06  7:56 ` Thomas Renninger [this message]
2010-07-06  8:07   ` Axel Lin
2010-07-06  8:11     ` Thomas Renninger

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=201007060956.45726.trenn@suse.de \
    --to=trenn@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=anisse@astier.eu \
    --cc=axel.lin@gmail.com \
    --cc=elendil@planet.nl \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox