port: fix dead code in ring

Message ID 20210407105945.18064-1-cristian.dumitrescu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series port: fix dead code in ring |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success travis build: passed
ci/github-robot success github build: passed
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Cristian Dumitrescu April 7, 2021, 10:59 a.m. UTC
  Fix logically dead code in ring port.

Coverity issue: 369664
Fixes: 77a413017c2d ("port: add ring SWX port")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_port/rte_swx_port_ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon April 19, 2021, 5:41 p.m. UTC | #1
07/04/2021 12:59, Cristian Dumitrescu:
> Fix logically dead code in ring port.
> 
> Coverity issue: 369664
> Fixes: 77a413017c2d ("port: add ring SWX port")
> 
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

It's not really fixing dead code but allocation check.
With title fixed, applied, thanks.
  

Patch

diff --git a/lib/librte_port/rte_swx_port_ring.c b/lib/librte_port/rte_swx_port_ring.c
index 4df720d91..8a076a213 100644
--- a/lib/librte_port/rte_swx_port_ring.c
+++ b/lib/librte_port/rte_swx_port_ring.c
@@ -195,7 +195,7 @@  writer_create(void *args)
 		goto error;
 
 	p->params.name = strdup(params->name);
-	if (!p)
+	if (!p->params.name)
 		goto error;
 
 	p->pkts = calloc(params->burst_size, sizeof(struct rte_mbuf *));