summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2009-03-20 10:24:40 +1000
committerBen Skeggs <bskeggs@redhat.com>2009-03-20 10:25:16 +1000
commitc37fca4ef678667bcba9c45c6e0a59c8d174c7c5 (patch)
tree567ca4c26441d755cf27efaba15cbeff8d562dce /libdrm
parent00d8e960ca665b7f0528438331f4d0ae77fbb4cc (diff)
libdrm/nouveau: incr refcount on ref fence before decr on old fence
Diffstat (limited to 'libdrm')
-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;
}