Mesa (main): zink: Remove unnecessary null checks.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 17 01:39:21 UTC 2021


Module: Mesa
Branch: main
Commit: ac1ddfba35c6451f86152a5a8e86d9ff2c5b4467
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac1ddfba35c6451f86152a5a8e86d9ff2c5b4467

Author: Vinson Lee <vlee at freedesktop.org>
Date:   Mon Aug  9 20:40:31 2021 -0700

zink: Remove unnecessary null checks.

Fix defects reported by Coverity Scan.

Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking sa suggests that it may be null,
but it has already been dereferenced on all paths leading to the
check.
check_after_deref: Null-checking sb suggests that it may be null,
but it has already been dereferenced on all paths leading to the
check.

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12298>

---

 src/gallium/drivers/zink/zink_program.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c
index 13b118c9f29..bb205f729c9 100644
--- a/src/gallium/drivers/zink/zink_program.c
+++ b/src/gallium/drivers/zink/zink_program.c
@@ -332,7 +332,7 @@ equals_gfx_pipeline_state(const void *a, const void *b)
       if (sa->front_face != sb->front_face)
          return false;
       if (!!sa->depth_stencil_alpha_state != !!sb->depth_stencil_alpha_state ||
-          (sa && sb && memcmp(sa->depth_stencil_alpha_state, sb->depth_stencil_alpha_state, sizeof(struct zink_depth_stencil_alpha_hw_state))))
+          memcmp(sa->depth_stencil_alpha_state, sb->depth_stencil_alpha_state, sizeof(struct zink_depth_stencil_alpha_hw_state)))
          return false;
    }
    return !memcmp(sa->modules, sb->modules, sizeof(sa->modules)) &&



More information about the mesa-commit mailing list