From 9ce45ac808e34bced2df346057beb8ab10313a87 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 21 Aug 2019 08:59:57 -0700 Subject: [PATCH] pan/decode: Remove all_zero The checks confuse Coverity, so let's make it explicit what's going on. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/pandecode/decode.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c index dee89889c2b..de7365b3932 100644 --- a/src/panfrost/pandecode/decode.c +++ b/src/panfrost/pandecode/decode.c @@ -1322,21 +1322,14 @@ pandecode_shader_address(const char *name, mali_ptr ptr) return shader_ptr; } -static bool -all_zero(unsigned *buffer, unsigned count) -{ - for (unsigned i = 0; i < count; ++i) { - if (buffer[i]) - return false; - } - - return true; -} - static void pandecode_stencil(const char *name, const struct mali_stencil_test *stencil) { - if (all_zero((unsigned *) stencil, sizeof(stencil) / sizeof(unsigned))) + unsigned any_nonzero = + stencil->ref | stencil->mask | stencil->func | + stencil->sfail | stencil->dpfail | stencil->dppass; + + if (any_nonzero == 0) return; const char *func = pandecode_func(stencil->func); @@ -1418,7 +1411,8 @@ pandecode_bifrost_blend(void *descs, int job_no, int rt_no) static mali_ptr pandecode_midgard_blend(union midgard_blend *blend, bool is_shader) { - if (all_zero((unsigned *) blend, sizeof(blend) / sizeof(unsigned))) + /* constant/equation is in a union */ + if (!blend->shader) return 0; pandecode_log(".blend = {\n"); -- 2.30.2