OSDN Git Service

libdrm/nouveau: incr refcount on ref fence before decr on old fence
authorBen Skeggs <bskeggs@redhat.com>
Fri, 20 Mar 2009 00:24:40 +0000 (10:24 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 20 Mar 2009 00:25:16 +0000 (10:25 +1000)
libdrm/nouveau/nouveau_fence.c

index e31fc89..3346616 100644 (file)
@@ -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;
 }