lib/cryptodev: fix assertion to remove GCC compilation warning

Message ID 20230522184951.452626-1-kamilx.godzwon@intel.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series lib/cryptodev: fix assertion to remove GCC compilation warning |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-abi-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS

Commit Message

Kamil Godzwon May 22, 2023, 6:49 p.m. UTC
  /home/vagrant/dpdk/build/include/rte_crypto_sym.h:1009:4: warning: Value stored to 'left' is never read [deadcode.DeadStores]
                          left = 0;
                          ^      ~
  1 warning generated.

Compilator sees that the variable 'left' is never read after
assignment a '0' value. To get rid of this warning message, use 'if'
condition to verify the 'left' value before RTE_ASSERT.

Signed-off-by: Kamil Godzwon <kamilx.godzwon@intel.com>
---
 lib/cryptodev/rte_crypto_sym.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Patch

diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
index b43174dbec..d7183a0b9e 100644
--- a/lib/cryptodev/rte_crypto_sym.h
+++ b/lib/cryptodev/rte_crypto_sym.h
@@ -1016,7 +1016,10 @@  rte_crypto_mbuf_to_vec(const struct rte_mbuf *mb, uint32_t ofs, uint32_t len,
 		left -= seglen;
 	}
 
-	RTE_ASSERT(left == 0);
+	if (left != 0) {
+		RTE_ASSERT(false);
+	}
+
 	return i;
 }