mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-11 12:44:49 -04:00
Staging: asus_oled: Add NULL test for kmalloc
This patch adds a NULL test to check wether kmalloc was successful or not. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c424d46fdc
commit
0df28be06e
@@ -430,6 +430,11 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev,
|
||||
|
||||
kfree(odev->buf);
|
||||
odev->buf = kmalloc(odev->buf_size, GFP_KERNEL);
|
||||
if (odev->buf == NULL) {
|
||||
odev->buf_size = 0;
|
||||
printk(ASUS_OLED_ERROR "Out of memory!\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memset(odev->buf, 0xff, odev->buf_size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user