diff mbox series

[v2,47/83] net/dpaa2: remove unnecessary NULL checks

Message ID 20220124174719.14417-48-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 warning coding style issues

Commit Message

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

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by:  Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 3 +--
 drivers/net/dpaa2/dpaa2_mux.c    | 3 +--
 drivers/net/dpaa2/dpaa2_ptp.c    | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 2b04f1416853..6b85b7740cfa 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -504,8 +504,7 @@  dpaa2_free_rx_tx_queues(struct rte_eth_dev *dev)
 		/* cleaning up queue storage */
 		for (i = 0; i < priv->nb_rx_queues; i++) {
 			dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[i];
-			if (dpaa2_q->q_storage)
-				rte_free(dpaa2_q->q_storage);
+			rte_free(dpaa2_q->q_storage);
 		}
 		/* cleanup tx queue cscn */
 		for (i = 0; i < priv->nb_tx_queues; i++) {
diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c
index cd2f7b8aa544..bd4596b89149 100644
--- a/drivers/net/dpaa2/dpaa2_mux.c
+++ b/drivers/net/dpaa2/dpaa2_mux.c
@@ -353,8 +353,7 @@  dpaa2_create_dpdmux_device(int vdev_fd __rte_unused,
 	return 0;
 
 init_err:
-	if (dpdmux_dev)
-		rte_free(dpdmux_dev);
+	rte_free(dpdmux_dev);
 
 	return -1;
 }
diff --git a/drivers/net/dpaa2/dpaa2_ptp.c b/drivers/net/dpaa2/dpaa2_ptp.c
index 8d79e392445a..5fcc36abe7b0 100644
--- a/drivers/net/dpaa2/dpaa2_ptp.c
+++ b/drivers/net/dpaa2/dpaa2_ptp.c
@@ -168,8 +168,7 @@  dpaa2_create_dprtc_device(int vdev_fd __rte_unused,
 	return 0;
 
 init_err:
-	if (dprtc_dev)
-		rte_free(dprtc_dev);
+	rte_free(dprtc_dev);
 
 	return -1;
 }