[Mesa-dev] [PATCH] radeon: Fix GCC unused-but-set-variable warnings.

Vinson Lee vlee at freedesktop.org
Fri Mar 6 22:28:06 PST 2015


radeon_fbo.c: In function ‘radeon_map_renderbuffer_s8z24’:
radeon_fbo.c:162:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
     int ret;
         ^
radeon_fbo.c: In function ‘radeon_map_renderbuffer_z16’:
radeon_fbo.c:200:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
     int ret;
         ^
radeon_fbo.c: In function ‘radeon_map_renderbuffer’:
radeon_fbo.c:242:8: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
    int ret;
        ^
radeon_fbo.c: In function ‘radeon_unmap_renderbuffer’:
radeon_fbo.c:419:14: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
    GLboolean ok;
              ^

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 src/mesa/drivers/dri/radeon/radeon_fbo.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index 110b030..2e3cb2b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -169,6 +169,9 @@ radeon_map_renderbuffer_s8z24(struct gl_context *ctx,
     rrb->map_buffer = malloc(w * h * 4);
     ret = radeon_bo_map(rrb->bo, !!(mode & GL_MAP_WRITE_BIT));
     assert(!ret);
+    if (!ret) {
+	return;
+    }
     untiled_s8z24_map = rrb->map_buffer;
     tiled_s8z24_map = rrb->bo->ptr;
 
@@ -207,6 +210,9 @@ radeon_map_renderbuffer_z16(struct gl_context *ctx,
     rrb->map_buffer = malloc(w * h * 2);
     ret = radeon_bo_map(rrb->bo, !!(mode & GL_MAP_WRITE_BIT));
     assert(!ret);
+    if (!ret) {
+        return;
+    }
 
     untiled_z16_map = rrb->map_buffer;
     tiled_z16_map = rrb->bo->ptr;
@@ -291,6 +297,9 @@ radeon_map_renderbuffer(struct gl_context *ctx,
 
        ret = radeon_bo_map(rrb->map_bo, !!(mode & GL_MAP_WRITE_BIT));
        assert(!ret);
+       if (!ret) {
+	   return;
+       }
 
        map = rrb->map_bo->ptr;
 
@@ -449,6 +458,7 @@ radeon_unmap_renderbuffer(struct gl_context *ctx,
 			    rrb->map_w, rrb->map_h,
 			    GL_FALSE);
       assert(ok);
+      (void) ok;
    }
 
    radeon_bo_unref(rrb->map_bo);
-- 
2.3.1



More information about the mesa-dev mailing list