gallium: Remove duplicate resource variable.
authorVinson Lee <vlee@freedesktop.org>
Tue, 27 Oct 2020 02:55:07 +0000 (19:55 -0700)
committerVinson Lee <vlee@freedesktop.org>
Tue, 3 Nov 2020 01:48:56 +0000 (17:48 -0800)
Fix defect reported by Coverity Scan.

Evaluation order violation (EVALUATION_ORDER)
write_write_typo: In resource = resource =
ntt_ureg_src_indirect(c, ureg_src_register(TGSI_FILE_IMAGE, 0U),
instr->src[0]), resource is written twice with the same value.

Fixes: 34cc6a804ec9 ("gallium: Add a nir-to-TGSI pass.")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7326>

src/gallium/auxiliary/nir/nir_to_tgsi.c

index 2311927..d74eafd 100644 (file)
@@ -1222,8 +1222,8 @@ ntt_emit_image_load_store(struct ntt_compile *c, nir_intrinsic_instr *instr)
                                    nir_intrinsic_image_array(instr));
 
    struct ureg_src resource =
-      resource = ntt_ureg_src_indirect(c, ureg_src_register(TGSI_FILE_IMAGE, 0),
-                                       instr->src[0]);
+      ntt_ureg_src_indirect(c, ureg_src_register(TGSI_FILE_IMAGE, 0),
+                            instr->src[0]);
 
    struct ureg_dst dst;
    if (instr->intrinsic == nir_intrinsic_image_store) {