Commit 31f00759 authored by Dan Carpenter's avatar Dan Carpenter Committed by Matthew Garrett

sony-laptop: handle allocation failures

Return -ENOMEM if kzalloc() fails.  The callers already handle error
returns.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
parent 7227dedb
...@@ -768,6 +768,8 @@ static int sony_nc_handles_setup(struct platform_device *pd) ...@@ -768,6 +768,8 @@ static int sony_nc_handles_setup(struct platform_device *pd)
int result; int result;
handles = kzalloc(sizeof(*handles), GFP_KERNEL); handles = kzalloc(sizeof(*handles), GFP_KERNEL);
if (!handles)
return -ENOMEM;
sysfs_attr_init(&handles->devattr.attr); sysfs_attr_init(&handles->devattr.attr);
handles->devattr.attr.name = "handles"; handles->devattr.attr.name = "handles";
...@@ -1458,6 +1460,8 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd) ...@@ -1458,6 +1460,8 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd)
return 0; return 0;
kbdbl_handle = kzalloc(sizeof(*kbdbl_handle), GFP_KERNEL); kbdbl_handle = kzalloc(sizeof(*kbdbl_handle), GFP_KERNEL);
if (!kbdbl_handle)
return -ENOMEM;
sysfs_attr_init(&kbdbl_handle->mode_attr.attr); sysfs_attr_init(&kbdbl_handle->mode_attr.attr);
kbdbl_handle->mode_attr.attr.name = "kbd_backlight"; kbdbl_handle->mode_attr.attr.name = "kbd_backlight";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment