summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdrm/nouveau/nouveau_fence.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/libdrm/nouveau/nouveau_fence.c b/libdrm/nouveau/nouveau_fence.c
index e31fc89c..33466160 100644
--- a/libdrm/nouveau/nouveau_fence.c
+++ b/libdrm/nouveau/nouveau_fence.c
@@ -96,22 +96,16 @@ nouveau_fence_new(struct nouveau_channel *chan, struct nouveau_fence **fence)
int
nouveau_fence_ref(struct nouveau_fence *ref, struct nouveau_fence **fence)
{
- struct nouveau_fence_priv *nvfence;
-
if (!fence)
return -EINVAL;
- if (*fence) {
- nouveau_fence_del(fence);
- *fence = NULL;
- }
+ if (ref)
+ nouveau_fence(ref)->refcount++;
- if (ref) {
- nvfence = nouveau_fence(ref);
- nvfence->refcount++;
- *fence = &nvfence->base;
- }
+ if (*fence)
+ nouveau_fence_del(fence);
+ *fence = ref;
return 0;
}