diff options
author | Peter Huewe <peterhuewe@gmx.de> | 2010-01-07 19:57:36 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-03 16:42:40 -0800 |
commit | 0df28be06e08b9a53c26a53974bf3afea4928b3e (patch) | |
tree | b6339716fab0cfbe78ee6670a5641d50ee3b6f75 /drivers/staging | |
parent | c424d46fdc79df201707fe815aa8480751918025 (diff) |
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/asus_oled/asus_oled.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c index 0c1fb0d618a..c597fb27bd5 100644 --- a/drivers/staging/asus_oled/asus_oled.c +++ b/drivers/staging/asus_oled/asus_oled.c @@ -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); |