public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 3/3] sony-laptop: handle allocation failures
@ 2011-02-26 12:55 Dan Carpenter
  2011-02-27 12:14 ` Mattia Dongili
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-02-26 12:55 UTC (permalink / raw)
  To: Mattia Dongili; +Cc: Matthew Garrett, platform-driver-x86, kernel-janitors

Return -ENOMEM if kzalloc() fails.  The callers already handle error
returns.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index d0d0522..0db9049 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -768,6 +768,8 @@ static int sony_nc_handles_setup(struct platform_device *pd)
 	int result;
 
 	handles = kzalloc(sizeof(*handles), GFP_KERNEL);
+	if (!handles)
+		return -ENOMEM;
 
 	sysfs_attr_init(&handles->devattr.attr);
 	handles->devattr.attr.name = "handles";
@@ -1458,6 +1460,8 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd)
 		return 0;
 
 	kbdbl_handle = kzalloc(sizeof(*kbdbl_handle), GFP_KERNEL);
+	if (!kbdbl_handle)
+		return -ENOMEM;
 
 	sysfs_attr_init(&kbdbl_handle->mode_attr.attr);
 	kbdbl_handle->mode_attr.attr.name = "kbd_backlight";

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

* Re: [patch 3/3] sony-laptop: handle allocation failures
  2011-02-26 12:55 [patch 3/3] sony-laptop: handle allocation failures Dan Carpenter
@ 2011-02-27 12:14 ` Mattia Dongili
  0 siblings, 0 replies; 2+ messages in thread
From: Mattia Dongili @ 2011-02-27 12:14 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Matthew Garrett, platform-driver-x86, kernel-janitors

On Sat, Feb 26, 2011 at 03:55:24PM +0300, Dan Carpenter wrote:
> Return -ENOMEM if kzalloc() fails.  The callers already handle error
> returns.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Acked-by: Mattia Dongili <malattia@linux.it>

> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
> index d0d0522..0db9049 100644
> --- a/drivers/platform/x86/sony-laptop.c
> +++ b/drivers/platform/x86/sony-laptop.c
> @@ -768,6 +768,8 @@ static int sony_nc_handles_setup(struct platform_device *pd)
>  	int result;
>  
>  	handles = kzalloc(sizeof(*handles), GFP_KERNEL);
> +	if (!handles)
> +		return -ENOMEM;
>  
>  	sysfs_attr_init(&handles->devattr.attr);
>  	handles->devattr.attr.name = "handles";
> @@ -1458,6 +1460,8 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd)
>  		return 0;
>  
>  	kbdbl_handle = kzalloc(sizeof(*kbdbl_handle), GFP_KERNEL);
> +	if (!kbdbl_handle)
> +		return -ENOMEM;
>  
>  	sysfs_attr_init(&kbdbl_handle->mode_attr.attr);
>  	kbdbl_handle->mode_attr.attr.name = "kbd_backlight";
-- 
mattia
:wq!

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

end of thread, other threads:[~2011-02-27 12:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-26 12:55 [patch 3/3] sony-laptop: handle allocation failures Dan Carpenter
2011-02-27 12:14 ` Mattia Dongili

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