Commit 31f007598cc547ba3239524470386af8ae5f1c13
Committed by
Matthew Garrett
1 parent
7227dedbc2
Exists in
master
and in
4 other branches
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>
Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff
drivers/platform/x86/sony-laptop.c
... | ... | @@ -768,6 +768,8 @@ |
768 | 768 | int result; |
769 | 769 | |
770 | 770 | handles = kzalloc(sizeof(*handles), GFP_KERNEL); |
771 | + if (!handles) | |
772 | + return -ENOMEM; | |
771 | 773 | |
772 | 774 | sysfs_attr_init(&handles->devattr.attr); |
773 | 775 | handles->devattr.attr.name = "handles"; |
... | ... | @@ -1458,6 +1460,8 @@ |
1458 | 1460 | return 0; |
1459 | 1461 | |
1460 | 1462 | kbdbl_handle = kzalloc(sizeof(*kbdbl_handle), GFP_KERNEL); |
1463 | + if (!kbdbl_handle) | |
1464 | + return -ENOMEM; | |
1461 | 1465 | |
1462 | 1466 | sysfs_attr_init(&kbdbl_handle->mode_attr.attr); |
1463 | 1467 | kbdbl_handle->mode_attr.attr.name = "kbd_backlight"; |