r600g: Only increase a bo's map_count if radeon_bo_map() succeeded.
authorTilman Sauerbeck <tilman@code-monkey.de>
Thu, 9 Sep 2010 13:24:50 +0000 (15:24 +0200)
committerTilman Sauerbeck <tilman@code-monkey.de>
Fri, 10 Sep 2010 11:09:33 +0000 (13:09 +0200)
Signed-off-by: Tilman Sauerbeck <tilman@code-monkey.de>
src/gallium/winsys/r600/drm/radeon_bo.c

index a1306f6e9d2f077799d9441b9aa744122017cbaf..f79135bfa169ac33733f82c27aa2511c1e0b6695 100644 (file)
@@ -96,8 +96,8 @@ int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo)
        void *ptr;
        int r;
 
-       if (bo->map_count++ != 0) {
-               return 0;
+       if (bo->map_count != 0) {
+               goto success;
        }
        /* Zero out args to make valgrind happy */
        memset(&args, 0, sizeof(args));
@@ -117,6 +117,10 @@ int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo)
                return -errno;
        }
        bo->data = ptr;
+
+success:
+       bo->map_count++;
+
        return 0;
 }