[Mesa-dev] [PATCH] radeonsi: silence a coverity warning

Nicolai Hähnle nhaehnle at gmail.com
Wed Mar 23 17:00:46 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

The following Coverity warning

5378     	tmpl.fetch_args = atomic_fetch_args;
5379     	tmpl.emit = atomic_emit;
>>>     CID 1357115:  Uninitialized variables  (UNINIT)
>>>     Using uninitialized value "tmpl". Field "tmpl.intr_name" is uninitialized.
5380     	bld_base->op_actions[TGSI_OPCODE_ATOMUADD] = tmpl;
5381     	bld_base->op_actions[TGSI_OPCODE_ATOMUADD].intr_name = "add";

... is a false positive, but what the hell. This change should "fix" it.
---
 src/gallium/drivers/radeonsi/si_shader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 1e4bf82..9eb531f 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5362,7 +5362,7 @@ static void si_init_shader_ctx(struct si_shader_context *ctx,
 			       LLVMTargetMachineRef tm)
 {
 	struct lp_build_tgsi_context *bld_base;
-	struct lp_build_tgsi_action tmpl;
+	struct lp_build_tgsi_action tmpl = {};
 
 	memset(ctx, 0, sizeof(*ctx));
 	radeon_llvm_context_init(&ctx->radeon_bld, "amdgcn--");
-- 
2.5.0



More information about the mesa-dev mailing list