[v21.02,v3,09/10] app/crypto-perf: remove always true condition

Message ID 20201119115900.4095566-10-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series cppcheck |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ferruh Yigit Nov. 19, 2020, 11:58 a.m. UTC
  This is already 'else' leg of the opposite comparison, simple 'else'
will be logically same.

Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 app/test-crypto-perf/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Fan Zhang Nov. 23, 2020, 3:25 p.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Ferruh Yigit
> Sent: Thursday, November 19, 2020 11:59 AM
> To: dev@dpdk.org; Doherty, Declan <declan.doherty@intel.com>; Kerlin,
> Marcin <marcin.kerlin@intel.com>; Mrozowicz, SlawomirX
> <slawomirx.mrozowicz@intel.com>; Kobylinski, Michal
> <michal.kobylinski@intel.com>; Piotr Azarewicz
> <piotrx.t.azarewicz@intel.com>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [v21.02 v3 09/10] app/crypto-perf: remove always true
> condition
> 
> This is already 'else' leg of the opposite comparison, simple 'else'
> will be logically same.
> 
> Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
> application")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
>  app/test-crypto-perf/main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
> index 5f035519c3..99f86e9019 100644
> --- a/app/test-crypto-perf/main.c
> +++ b/app/test-crypto-perf/main.c
> @@ -390,7 +390,7 @@ cperf_check_test_vector(struct cperf_options *opts,
>  		if (opts->cipher_algo == RTE_CRYPTO_CIPHER_NULL) {
>  			if (test_vec->plaintext.data == NULL)
>  				return -1;
> -		} else if (opts->cipher_algo != RTE_CRYPTO_CIPHER_NULL) {
> +		} else {
>  			if (test_vec->plaintext.data == NULL)
>  				return -1;
>  			if (test_vec->plaintext.length < opts-
> >max_buffer_size)
> @@ -440,7 +440,7 @@ cperf_check_test_vector(struct cperf_options *opts,
>  				return -1;
>  			if (test_vec->plaintext.length < opts-
> >max_buffer_size)
>  				return -1;
> -		} else if (opts->cipher_algo != RTE_CRYPTO_CIPHER_NULL) {
> +		} else {
>  			if (test_vec->plaintext.data == NULL)
>  				return -1;
>  			if (test_vec->plaintext.length < opts-
> >max_buffer_size)
> --
> 2.26.2

Thanks Ferruh!

Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
  

Patch

diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c
index 5f035519c3..99f86e9019 100644
--- a/app/test-crypto-perf/main.c
+++ b/app/test-crypto-perf/main.c
@@ -390,7 +390,7 @@  cperf_check_test_vector(struct cperf_options *opts,
 		if (opts->cipher_algo == RTE_CRYPTO_CIPHER_NULL) {
 			if (test_vec->plaintext.data == NULL)
 				return -1;
-		} else if (opts->cipher_algo != RTE_CRYPTO_CIPHER_NULL) {
+		} else {
 			if (test_vec->plaintext.data == NULL)
 				return -1;
 			if (test_vec->plaintext.length < opts->max_buffer_size)
@@ -440,7 +440,7 @@  cperf_check_test_vector(struct cperf_options *opts,
 				return -1;
 			if (test_vec->plaintext.length < opts->max_buffer_size)
 				return -1;
-		} else if (opts->cipher_algo != RTE_CRYPTO_CIPHER_NULL) {
+		} else {
 			if (test_vec->plaintext.data == NULL)
 				return -1;
 			if (test_vec->plaintext.length < opts->max_buffer_size)