From d08c0930af8aaef5bdf80df618bb906e0b349830 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Fri, 10 Mar 2017 17:20:56 +0000 Subject: [PATCH] winsys/radeon: check null return from radeon_cs_create_fence in cs_flush MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Follow-up of patch: "radeon_cs_create_fence: check null return from radeon_winsys_bo_create" radeon_drm_cs_flush radeon_cs_create_fence radeon_winsys_bo_create Signed-off-by: Julien Isorce Signed-off-by: Marek Olšák --- src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c index 1545fd82637..f59b5399e4c 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c @@ -593,18 +593,20 @@ static int radeon_drm_cs_flush(struct radeon_winsys_cs *rcs, fence = radeon_cs_create_fence(rcs); } - if (pfence) - radeon_fence_reference(pfence, fence); - - mtx_lock(&cs->ws->bo_fence_lock); - for (unsigned i = 0; i < cs->csc->num_slab_buffers; ++i) { - struct radeon_bo *bo = cs->csc->slab_buffers[i].bo; - p_atomic_inc(&bo->num_active_ioctls); - radeon_bo_slab_fence(bo, (struct radeon_bo *)fence); - } - mtx_unlock(&cs->ws->bo_fence_lock); + if (fence) { + if (pfence) + radeon_fence_reference(pfence, fence); + + mtx_lock(&cs->ws->bo_fence_lock); + for (unsigned i = 0; i < cs->csc->num_slab_buffers; ++i) { + struct radeon_bo *bo = cs->csc->slab_buffers[i].bo; + p_atomic_inc(&bo->num_active_ioctls); + radeon_bo_slab_fence(bo, (struct radeon_bo *)fence); + } + mtx_unlock(&cs->ws->bo_fence_lock); - radeon_fence_reference(&fence, NULL); + radeon_fence_reference(&fence, NULL); + } } else { radeon_fence_reference(&cs->next_fence, NULL); } -- 2.30.2