[v2,7/7] event/sw: remove unnecessary NULL check

Message ID 20220220005140.78713-8-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series fix more unnecessary null checks |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Stephen Hemminger Feb. 20, 2022, 12:51 a.m. UTC
  The rte_event_ring_free() function already handles NULL pointer.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/event/sw/sw_evdev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Patch

diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index ba82a80385b6..f93313b31b5c 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -166,8 +166,7 @@  sw_port_setup(struct rte_eventdev *dev, uint8_t port_id,
 	snprintf(buf, sizeof(buf), "sw%d_p%u_%s", dev->data->dev_id,
 			port_id, "rx_worker_ring");
 	struct rte_event_ring *existing_ring = rte_event_ring_lookup(buf);
-	if (existing_ring)
-		rte_event_ring_free(existing_ring);
+	rte_event_ring_free(existing_ring);
 
 	p->rx_worker_ring = rte_event_ring_create(buf, MAX_SW_PROD_Q_DEPTH,
 			dev->data->socket_id,
@@ -186,8 +185,7 @@  sw_port_setup(struct rte_eventdev *dev, uint8_t port_id,
 	snprintf(buf, sizeof(buf), "sw%d_p%u, %s", dev->data->dev_id,
 			port_id, "cq_worker_ring");
 	existing_ring = rte_event_ring_lookup(buf);
-	if (existing_ring)
-		rte_event_ring_free(existing_ring);
+	rte_event_ring_free(existing_ring);
 
 	p->cq_worker_ring = rte_event_ring_create(buf, conf->dequeue_depth,
 			dev->data->socket_id,