gpu: ion: fix printk when alloc failed
author黄涛 <huangtao@rock-chips.com>
Mon, 19 Dec 2011 02:07:34 +0000 (10:07 +0800)
committer黄涛 <huangtao@rock-chips.com>
Mon, 19 Dec 2011 02:07:34 +0000 (10:07 +0800)
drivers/gpu/ion/ion.c

index 16580a8f6ec25d05472cf05ab00f267003474e0f..16dedc19b118041c81ff886663e3ac3acc22d0fa 100755 (executable)
@@ -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: