Remove redundant NULL pointer checks before free functions
found by nullfree.cocci
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/ip_pipeline/cli.c | 12 ++++--------
examples/ip_pipeline/cryptodev.c | 6 ++----
examples/ip_pipeline/thread.c | 6 ++----
3 files changed, 8 insertions(+), 16 deletions(-)
@@ -3773,10 +3773,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)
@@ -3785,10 +3783,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;
@@ -151,10 +151,8 @@ cryptodev_create(const char *name, struct cryptodev_params *params)
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);
@@ -92,11 +92,9 @@ thread_free(void)
continue;
/* 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);
}
}