From 322fa3e5be5cd08ce752075f4fbff15019b8d6c7 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Mon, 16 Jul 2018 15:22:50 -0700 Subject: intel/blorp: fix uninitialized variable warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compiler doesn't pick up that level and start_layer will be defined, so do as was done for num_layers in 4d8b476fa9a "intel/blorp: Fix compiler warning about num_layers." and always set it. Fixes warning ../../src/mesa/drivers/dri/i965/brw_blorp.c: In function ‘brw_blorp_clear_depth_stencil’: ../../src/mesa/drivers/dri/i965/brw_blorp.c:1439:4: warning: ‘start_layer’ may be used uninitialized in this function [-Wmaybe-uninitialized] blorp_clear_depth_stencil(&batch, &depth_surf, &stencil_surf, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ level, start_layer, num_layers, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ x0, y0, x1, y1, ~~~~~~~~~~~~~~~ (mask & BUFFER_BIT_DEPTH), ctx->Depth.Clear, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ stencil_mask, ctx->Stencil.Clear); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/mesa/drivers/dri/i965/brw_blorp.c:1439:4: warning: ‘level’ may be used uninitialized in this function [-Wmaybe-uninitialized] Reviewed-by: Anuj Phogat --- src/mesa/drivers/dri/i965/brw_blorp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c index 9922c59f6e1..6192ace2253 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.c +++ b/src/mesa/drivers/dri/i965/brw_blorp.c @@ -1413,10 +1413,10 @@ brw_blorp_clear_depth_stencil(struct brw_context *brw, assert(level == irb->mt_level); assert(start_layer == irb->mt_layer); assert(num_layers == fb->MaxNumLayers ? irb->layer_count : 1); - } else { - level = irb->mt_level; - start_layer = irb->mt_layer; } + + level = irb->mt_level; + start_layer = irb->mt_layer; num_layers = fb->MaxNumLayers ? irb->layer_count : 1; stencil_mask = ctx->Stencil.WriteMask[0] & 0xff; -- cgit v1.2.3