nouveau: fix fence_ref() where fence and *ref are the same fence
authorBen Skeggs <bskeggs@redhat.com>
Tue, 1 Mar 2011 00:43:44 +0000 (10:43 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 1 Mar 2011 04:44:43 +0000 (14:44 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
src/gallium/drivers/nouveau/nouveau_fence.h

index 785fc8d2a0af7e248fa7458244db9b20ad54f1be..680c75e99f962ec17862da79c44fba46ebc050f2 100644 (file)
@@ -39,12 +39,13 @@ boolean nouveau_fence_signalled(struct nouveau_fence *);
 static INLINE void
 nouveau_fence_ref(struct nouveau_fence *fence, struct nouveau_fence **ref)
 {
+   if (fence)
+      ++fence->ref;
+
    if (*ref) {
       if (--(*ref)->ref == 0)
          nouveau_fence_del(*ref);
    }
-   if (fence)
-      ++fence->ref;
 
    *ref = fence;
 }