radeon: Check an error return instead of assigning it to a dead variable.
authorEric Anholt <eric@anholt.net>
Wed, 2 Nov 2011 21:38:05 +0000 (14:38 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 3 Nov 2011 16:13:46 +0000 (09:13 -0700)
Fixes gcc set-but-unused-variable warning.

Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
src/mesa/drivers/dri/radeon/radeon_common_context.c

index 2694dafc75f40fa87b8cbd19d229ad3cdff20266..e6c7f94af06a590af4eb2807b8ce940546f8633a 100644 (file)
@@ -551,11 +551,19 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable,
                        }
 
                        ret = radeon_bo_get_tiling(bo, &tiling_flags, &pitch);
-                       if (tiling_flags & RADEON_TILING_MACRO)
-                               bo->flags |= RADEON_BO_FLAGS_MACRO_TILE;
-                       if (tiling_flags & RADEON_TILING_MICRO)
-                               bo->flags |= RADEON_BO_FLAGS_MICRO_TILE;
-
+                       if (ret) {
+                               fprintf(stderr,
+                                       "failed to get tiling for %s %d\n",
+                                       regname, buffers[i].name);
+                               radeon_bo_unref(bo);
+                               bo = NULL;
+                               continue;
+                       } else {
+                               if (tiling_flags & RADEON_TILING_MACRO)
+                                       bo->flags |= RADEON_BO_FLAGS_MACRO_TILE;
+                               if (tiling_flags & RADEON_TILING_MICRO)
+                                       bo->flags |= RADEON_BO_FLAGS_MICRO_TILE;
+                       }
                }
 
                if (buffers[i].attachment == __DRI_BUFFER_DEPTH) {