From f8d520950edb5cec878999a09d3f7e6f8b15bf5e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 8 Mar 2012 12:13:36 +0000 Subject: [PATCH] sna: Avoid NULL deference in DBG Only print out the details of the allocated CPU bo, if we actually allocate it. Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index a1798a5e..08ee5374 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -313,10 +313,10 @@ sna_pixmap_alloc_cpu(struct sna *sna, pixmap->drawable.height, pixmap->drawable.bitsPerPixel, from_gpu ? 0 : CREATE_CPU_MAP | CREATE_INACTIVE); - DBG(("%s: allocated CPU handle=%d\n", __FUNCTION__, - priv->cpu_bo->handle)); - if (priv->cpu_bo) { + DBG(("%s: allocated CPU handle=%d\n", __FUNCTION__, + priv->cpu_bo->handle)); + priv->ptr = kgem_bo_map__cpu(&sna->kgem, priv->cpu_bo); priv->stride = priv->cpu_bo->pitch; }