mesa: Remove extra texObj.
authorVinson Lee <vlee@freedesktop.org>
Wed, 9 Dec 2020 06:04:53 +0000 (22:04 -0800)
committerVinson Lee <vlee@freedesktop.org>
Sat, 12 Dec 2020 02:04:50 +0000 (18:04 -0800)
Fix defect reported by Coverity Scan.

Evaluation order violation (EVALUATION_ORDER)
write_write_typo: In texObj = texObj = _mesa_get_tex_unit(ctx, u)->CurrentTex[tgt], texObj is written twice with the same value.

Fixes: d0e18550e26 ("mesa: optimize saving/restoring bound textures for glPush/PopAttrib")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8000>

src/mesa/main/attrib.c

index 11677eb..51c3bc3 100644 (file)
@@ -591,7 +591,7 @@ pop_texture_group(struct gl_context *ctx, struct gl_texture_attrib_node *texstat
       for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
          const struct gl_texture_object *savedObj = &texstate->SavedObj[u][tgt];
          struct gl_texture_object *texObj =
-            texObj = _mesa_get_tex_unit(ctx, u)->CurrentTex[tgt];
+            _mesa_get_tex_unit(ctx, u)->CurrentTex[tgt];
 
          if (texObj->Name != savedObj->Name) {
             /* We don't need to check whether the texture target is supported,