DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/zxdh: remove unnecessary null free checks
@ 2025-02-20 22:44 Stephen Hemminger
  0 siblings, 0 replies; only message in thread
From: Stephen Hemminger @ 2025-02-20 22:44 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Junlong Wang, Lijie Shan

Remove unnecessary checks for null pointer.
Found by devtools/cocci/nullfree.cocci script.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/zxdh/zxdh_ethdev.c | 3 +--
 drivers/net/zxdh/zxdh_np.c     | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/zxdh/zxdh_ethdev.c b/drivers/net/zxdh/zxdh_ethdev.c
index 858e3c3d47..4617ae3c2c 100644
--- a/drivers/net/zxdh/zxdh_ethdev.c
+++ b/drivers/net/zxdh/zxdh_ethdev.c
@@ -945,8 +945,7 @@ zxdh_np_dtb_data_res_free(struct zxdh_hw *hw)
 		if (ret)
 			PMD_DRV_LOG(ERR, "%s dpp_np_online_uninstall failed", dev->data->name);
 
-		if (g_dtb_data.dtb_table_conf_mz)
-			rte_memzone_free(g_dtb_data.dtb_table_conf_mz);
+		rte_memzone_free(g_dtb_data.dtb_table_conf_mz);
 
 		if (g_dtb_data.dtb_table_dump_mz) {
 			rte_memzone_free(g_dtb_data.dtb_table_dump_mz);
diff --git a/drivers/net/zxdh/zxdh_np.c b/drivers/net/zxdh/zxdh_np.c
index 1e6e8f0e75..06a28e0b04 100644
--- a/drivers/net/zxdh/zxdh_np.c
+++ b/drivers/net/zxdh/zxdh_np.c
@@ -873,8 +873,7 @@ zxdh_np_sdt_mgr_destroy(uint32_t dev_id)
 	p_sdt_tbl_temp = ZXDH_SDT_SOFT_TBL_GET(dev_id);
 	p_sdt_mgr = ZXDH_SDT_MGR_PTR_GET();
 
-	if (p_sdt_tbl_temp != NULL)
-		free(p_sdt_tbl_temp);
+	free(p_sdt_tbl_temp);
 
 	ZXDH_SDT_SOFT_TBL_GET(dev_id) = NULL;
 
-- 
2.47.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-02-20 22:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-20 22:44 [PATCH] net/zxdh: remove unnecessary null free checks Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).