Mesa (main): intel/blorp: initialize BLEND_STATE using braced initializer list

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 28 09:43:53 UTC 2021


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

Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date:   Thu Jun 24 17:01:43 2021 +0200

intel/blorp: initialize BLEND_STATE using braced initializer list

Coverity complains that memset has no effect, because of size 0.
Size of BLEND_STATE struct is 0 on gfx [6, 7.5], so memset has
nothing to do there. This is of course harmless, but we can make
code simpler by replacing memset with an empty initializer list
and at the same time avoid a warning from Coverity.

CID: 1486015

Signed-off-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>

---

 src/intel/blorp/blorp_genX_exec.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h
index ddc9dfb66d1..3089861c264 100644
--- a/src/intel/blorp/blorp_genX_exec.h
+++ b/src/intel/blorp/blorp_genX_exec.h
@@ -1079,8 +1079,7 @@ static uint32_t
 blorp_emit_blend_state(struct blorp_batch *batch,
                        const struct blorp_params *params)
 {
-   struct GENX(BLEND_STATE) blend;
-   memset(&blend, 0, sizeof(blend));
+   struct GENX(BLEND_STATE) blend = { };
 
    uint32_t offset;
    int size = GENX(BLEND_STATE_length) * 4;



More information about the mesa-commit mailing list