examples/ioat: resolve unchecked return value
diff mbox series

Message ID 20191128100325.25003-2-praveen.shetty@intel.com
State Superseded
Delegated to: Thomas Monjalon
Headers show
  • examples/ioat: resolve unchecked return value
Related show


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

Commit Message

Praveen Shetty Nov. 28, 2019, 10:03 a.m. UTC
patch checks the return value of function rte_eth_dev_info_get,
if return value is negative error message printed on the console.

Coverity issue: 350361

Signed-off-by: Praveen Shetty <praveen.shetty@intel.com>
 examples/ioat/ioatfwd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff mbox series

diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index e9117718f..b39a098ec 100644
--- a/examples/ioat/ioatfwd.c
+++ b/examples/ioat/ioatfwd.c
@@ -824,7 +824,11 @@  port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues)
 	/* Init port */
 	printf("Initializing port %u... ", portid);
-	rte_eth_dev_info_get(portid, &dev_info);
+	ret = rte_eth_dev_info_get(portid, &dev_info);
+	if (ret < 0)
+		rte_exit(EXIT_FAILURE, "Cannot get device info: %s, port=%u\n",
+			rte_strerror(-ret), portid);
 	local_port_conf.rx_adv_conf.rss_conf.rss_hf &=
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)