From c37fca4ef678667bcba9c45c6e0a59c8d174c7c5 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Fri, 20 Mar 2009 10:24:40 +1000 Subject: libdrm/nouveau: incr refcount on ref fence before decr on old fence --- libdrm/nouveau/nouveau_fence.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'libdrm/nouveau') 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; } -- cgit v1.2.3