diff mbox series

[80/82] port: remove unnecessary NULL checks

Message ID 20220124000518.319850-81-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, 12:05 a.m. UTC
Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/port/rte_port_source_sink.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/lib/port/rte_port_source_sink.c b/lib/port/rte_port_source_sink.c
index 68575c98338d..79042d13ff66 100644
--- a/lib/port/rte_port_source_sink.c
+++ b/lib/port/rte_port_source_sink.c
@@ -163,14 +163,10 @@  pcap_source_load(struct rte_port_source *port,
 	return 0;
 
 error_exit:
-	if (pkt_len_aligns)
-		rte_free(pkt_len_aligns);
-	if (port->pkt_len)
-		rte_free(port->pkt_len);
-	if (port->pkts)
-		rte_free(port->pkts);
-	if (port->pkt_buff)
-		rte_free(port->pkt_buff);
+	rte_free(pkt_len_aligns);
+	rte_free(port->pkt_len);
+	rte_free(port->pkts);
+	rte_free(port->pkt_buff);
 
 	return -1;
 }
@@ -242,12 +238,9 @@  rte_port_source_free(void *port)
 	if (p == NULL)
 		return 0;
 
-	if (p->pkt_len)
-		rte_free(p->pkt_len);
-	if (p->pkts)
-		rte_free(p->pkts);
-	if (p->pkt_buff)
-		rte_free(p->pkt_buff);
+	rte_free(p->pkt_len);
+	rte_free(p->pkts);
+	rte_free(p->pkt_buff);
 
 	rte_free(p);