Re: [patch 3/3] sony-laptop: handle allocation failures

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

 



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@xxxxxxxxx>

Acked-by: Mattia Dongili <malattia@xxxxxxxx>

> 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!
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux