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.veli...@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

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to