Skip to content

Commit

Permalink
sony-laptop: handle allocation failures
Browse files Browse the repository at this point in the history
Return -ENOMEM if kzalloc() fails.  The callers already handle error
returns.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
  • Loading branch information
Dan Carpenter authored and Matthew Garrett committed Mar 28, 2011
1 parent 7227ded commit 31f0075
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/platform/x86/sony-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 31f0075

Please sign in to comment.