From 50d910ace60cc77edcea2daf06cbe04f5d3c5ea8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Mon, 19 Dec 2011 10:07:34 +0800 Subject: [PATCH] gpu: ion: fix printk when alloc failed --- drivers/gpu/ion/ion.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c index 16580a8f6ec2..16dedc19b118 100755 --- a/drivers/gpu/ion/ion.c +++ b/drivers/gpu/ion/ion.c @@ -983,8 +983,12 @@ static long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data.flags); if (copy_to_user((void __user *)arg, &data, sizeof(data))) return -EFAULT; - printk("%s: alloc 0x%x bytes, phy addr is 0x%lx\n", - __func__, data.len, data.handle->buffer->priv_phys); + if (IS_ERR_OR_NULL(data.handle)) { + printk("%s: alloc 0x%x bytes failed\n", __func__, data.len); + } else { + printk("%s: alloc 0x%x bytes, phy addr is 0x%lx\n", + __func__, data.len, data.handle->buffer->priv_phys); + } break; } case ION_IOC_FREE: -- 2.34.1