From 1978f6d8d1215a9501882eb074901bcd0dfc0775 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Mon, 17 Aug 2009 21:21:02 +1000
Subject: radeon: fix bo wait at map time.

---
 libdrm/radeon/radeon_bo_gem.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'libdrm')

diff --git a/libdrm/radeon/radeon_bo_gem.c b/libdrm/radeon/radeon_bo_gem.c
index 3c3b3e5b..cf59a359 100644
--- a/libdrm/radeon/radeon_bo_gem.c
+++ b/libdrm/radeon/radeon_bo_gem.c
@@ -156,11 +156,7 @@ static int bo_map(struct radeon_bo *bo, int write)
         return 0;
     }
     if (bo_gem->priv_ptr) {
-	r = bo_wait(bo);
-	bo->ptr = bo_gem->priv_ptr;
-	if (r)
-		return r;
-	return 0;
+	goto wait;
     }
 
     bo->ptr = NULL;
@@ -180,8 +176,12 @@ static int bo_map(struct radeon_bo *bo, int write)
     if (ptr == MAP_FAILED)
         return -errno;
     bo_gem->priv_ptr = ptr;
+wait:
     bo->ptr = bo_gem->priv_ptr;
-    return r;
+    r = bo_wait(bo);
+    if (r)
+	return r;
+    return 0;
 }
 
 static int bo_unmap(struct radeon_bo *bo)
-- 
cgit v1.2.3