diff options
author | Dan Carpenter <error27@gmail.com> | 2011-02-26 07:55:24 -0500 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2011-03-28 06:07:25 -0400 |
commit | 31f007598cc547ba3239524470386af8ae5f1c13 (patch) | |
tree | e220633213d9a55c0380a2f0202b6467cdd37e06 /drivers/platform | |
parent | 7227dedbc22f66f1bd310c866053b08de0496e38 (diff) |
sony-laptop: handle allocation failures
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>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 363b89ef61cc..bd1b9adfbaf9 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) | |||
768 | int result; | 768 | int result; |
769 | 769 | ||
770 | handles = kzalloc(sizeof(*handles), GFP_KERNEL); | 770 | handles = kzalloc(sizeof(*handles), GFP_KERNEL); |
771 | if (!handles) | ||
772 | return -ENOMEM; | ||
771 | 773 | ||
772 | sysfs_attr_init(&handles->devattr.attr); | 774 | sysfs_attr_init(&handles->devattr.attr); |
773 | handles->devattr.attr.name = "handles"; | 775 | handles->devattr.attr.name = "handles"; |
@@ -1458,6 +1460,8 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd) | |||
1458 | return 0; | 1460 | return 0; |
1459 | 1461 | ||
1460 | kbdbl_handle = kzalloc(sizeof(*kbdbl_handle), GFP_KERNEL); | 1462 | kbdbl_handle = kzalloc(sizeof(*kbdbl_handle), GFP_KERNEL); |
1463 | if (!kbdbl_handle) | ||
1464 | return -ENOMEM; | ||
1461 | 1465 | ||
1462 | sysfs_attr_init(&kbdbl_handle->mode_attr.attr); | 1466 | sysfs_attr_init(&kbdbl_handle->mode_attr.attr); |
1463 | kbdbl_handle->mode_attr.attr.name = "kbd_backlight"; | 1467 | kbdbl_handle->mode_attr.attr.name = "kbd_backlight"; |