aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/radeon/drm
diff options
context:
space:
mode:
authorJulien Isorce <[email protected]>2017-03-10 17:20:56 +0000
committerMarek Olšák <[email protected]>2017-03-13 17:19:29 +0100
commitd08c0930af8aaef5bdf80df618bb906e0b349830 (patch)
tree5f66a73be9c6544cb7304afe8442e6b2f4e2dc09 /src/gallium/winsys/radeon/drm
parentd09edb01468ca385b6a8ffe29ac434dc42a78d07 (diff)
winsys/radeon: check null return from radeon_cs_create_fence in cs_flush
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 <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/winsys/radeon/drm')
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_cs.c24
1 files 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);
}