diff mbox series

[v2,64/83] net/softnic: remove unnecessary NULL checks

Message ID 20220124174719.14417-65-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series remove unnecessary null checks | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Jan. 24, 2022, 5:47 p.m. UTC
Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/softnic/rte_eth_softnic_cli.c       | 12 ++++--------
 drivers/net/softnic/rte_eth_softnic_cryptodev.c |  6 ++----
 drivers/net/softnic/rte_eth_softnic_thread.c    |  6 ++----
 3 files changed, 8 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index b04e78c6e0af..7acbeecae7a2 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -4482,10 +4482,8 @@  parse_free_sym_crypto_param_data(struct rte_table_action_sym_crypto_params *p)
 
 		switch (xform[i]->type) {
 		case RTE_CRYPTO_SYM_XFORM_CIPHER:
-			if (p->cipher_auth.cipher_iv.val)
-				free(p->cipher_auth.cipher_iv.val);
-			if (p->cipher_auth.cipher_iv_update.val)
-				free(p->cipher_auth.cipher_iv_update.val);
+			free(p->cipher_auth.cipher_iv.val);
+			free(p->cipher_auth.cipher_iv_update.val);
 			break;
 		case RTE_CRYPTO_SYM_XFORM_AUTH:
 			if (p->cipher_auth.auth_iv.val)
@@ -4494,10 +4492,8 @@  parse_free_sym_crypto_param_data(struct rte_table_action_sym_crypto_params *p)
 				free(p->cipher_auth.cipher_iv_update.val);
 			break;
 		case RTE_CRYPTO_SYM_XFORM_AEAD:
-			if (p->aead.iv.val)
-				free(p->aead.iv.val);
-			if (p->aead.aad.val)
-				free(p->aead.aad.val);
+			free(p->aead.iv.val);
+			free(p->aead.aad.val);
 			break;
 		default:
 			continue;
diff --git a/drivers/net/softnic/rte_eth_softnic_cryptodev.c b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
index 9a7d006f1a09..e4754055e90b 100644
--- a/drivers/net/softnic/rte_eth_softnic_cryptodev.c
+++ b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
@@ -159,10 +159,8 @@  softnic_cryptodev_create(struct pmd_internals *p,
 	return cryptodev;
 
 error_exit:
-	if (cryptodev->mp_create)
-		rte_mempool_free(cryptodev->mp_create);
-	if (cryptodev->mp_init)
-		rte_mempool_free(cryptodev->mp_init);
+	rte_mempool_free(cryptodev->mp_create);
+	rte_mempool_free(cryptodev->mp_init);
 
 	free(cryptodev);
 
diff --git a/drivers/net/softnic/rte_eth_softnic_thread.c b/drivers/net/softnic/rte_eth_softnic_thread.c
index a8c26a5b2377..1b3b3c33c175 100644
--- a/drivers/net/softnic/rte_eth_softnic_thread.c
+++ b/drivers/net/softnic/rte_eth_softnic_thread.c
@@ -29,11 +29,9 @@  softnic_thread_free(struct pmd_internals *softnic)
 		struct softnic_thread *t = &softnic->thread[i];
 
 		/* MSGQs */
-		if (t->msgq_req)
-			rte_ring_free(t->msgq_req);
+		rte_ring_free(t->msgq_req);
 
-		if (t->msgq_rsp)
-			rte_ring_free(t->msgq_rsp);
+		rte_ring_free(t->msgq_rsp);
 	}
 }