From: Dan Carpenter Date: Sat, 26 Feb 2011 12:55:24 +0000 (+0300) Subject: sony-laptop: handle allocation failures X-Git-Tag: v2.6.39-rc1~20^2^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31f007598cc547ba3239524470386af8ae5f1c13;p=platform%2Fkernel%2Flinux-3.10.git sony-laptop: handle allocation failures Return -ENOMEM if kzalloc() fails. The callers already handle error returns. Signed-off-by: Dan Carpenter Signed-off-by: Matthew Garrett --- diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 363b89e..bd1b9ad 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";