public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hp-wmi: add return value checking for input_allocate_device()
@ 2010-07-06  2:30 Axel Lin
  2010-07-06  7:56 ` Thomas Renninger
  0 siblings, 1 reply; 4+ messages in thread
From: Axel Lin @ 2010-07-06  2:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: Matthew Garrett, Len Brown, Andrew Morton, Frans Pop,
	Anisse Astier, platform-driver-x86

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";
-- 
1.5.4.3




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] hp-wmi: add return value checking for input_allocate_device()
  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
  2010-07-06  8:07   ` Axel Lin
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Renninger @ 2010-07-06  7:56 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Matthew Garrett, Len Brown, Andrew Morton,
	Frans Pop, Anisse Astier, platform-driver-x86

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hp-wmi: add return value checking for  input_allocate_device()
  2010-07-06  7:56 ` Thomas Renninger
@ 2010-07-06  8:07   ` Axel Lin
  2010-07-06  8:11     ` Thomas Renninger
  0 siblings, 1 reply; 4+ messages in thread
From: Axel Lin @ 2010-07-06  8:07 UTC (permalink / raw)
  To: Thomas Renninger
  Cc: linux-kernel, Matthew Garrett, Len Brown, Andrew Morton,
	Frans Pop, Anisse Astier, platform-driver-x86

hi Thomas,
2010/7/6 Thomas Renninger <trenn@suse.de>:
> 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.

Checking hp_wmi_input_setup() is already done in my previous patch.
( which is already merged in platform-driver-x86 tree.
http://git.kernel.org/?p=linux/kernel/git/mjg59/platform-drivers-x86.git;a=commitdiff;h=b035d5f9fcb6cd6bba44b764b17d885f4d960d37
).
Thus this patch only adds the return value checking for
input_allocate_device() in hp_wmi_input_setup().

Regards,
Axel


>
> Thanks,
>
>   Thomas
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hp-wmi: add return value checking for input_allocate_device()
  2010-07-06  8:07   ` Axel Lin
@ 2010-07-06  8:11     ` Thomas Renninger
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Renninger @ 2010-07-06  8:11 UTC (permalink / raw)
  To: axel.lin
  Cc: linux-kernel, Matthew Garrett, Len Brown, Andrew Morton,
	Frans Pop, Anisse Astier, platform-driver-x86

On Tuesday 06 July 2010 10:07:49 Axel Lin wrote:
> hi Thomas,
> 2010/7/6 Thomas Renninger <trenn@suse.de>:
...
> > Do you mind to incorporate above if you agree.
> 
> Checking hp_wmi_input_setup() is already done in my previous patch.
> ( which is already merged in platform-driver-x86 tree.
...
Perfect!
Acked-by: Thomas Renninger <trenn@suse.de>

     Thomas

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-07-06  8:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2010-07-06  8:07   ` Axel Lin
2010-07-06  8:11     ` Thomas Renninger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox