[Mesa-dev] [PATCHv2 2/4] nvc0: Silence uninitialized variable warning in the release build

Emil Velikov emil.l.velikov at gmail.com
Mon Jul 8 10:21:06 PDT 2013


Resolves the following gcc warning

 warning: 'ptr' may be used uninitialized in this function
    xy[0] = ptr[sample_index][0] * 0.0625f;
               ^

v2: Bail out when using non-conformant sample_count (spotted by calim)

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/gallium/drivers/nvc0/nvc0_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nvc0/nvc0_context.c b/src/gallium/drivers/nvc0/nvc0_context.c
index cd86040..2d6d315 100644
--- a/src/gallium/drivers/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nvc0/nvc0_context.c
@@ -394,7 +394,7 @@ nvc0_context_get_sample_position(struct pipe_context *pipe,
    case 8: ptr = ms8; break;
    default:
       assert(0);
-      break;
+      return;
    }
    xy[0] = ptr[sample_index][0] * 0.0625f;
    xy[1] = ptr[sample_index][1] * 0.0625f;
-- 
1.8.3.2



More information about the mesa-dev mailing list