examples/ioat: fix unchecked return value
authorPraveen Shetty <praveen.shetty@intel.com>
Thu, 28 Nov 2019 11:27:14 +0000 (11:27 +0000)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 13 Feb 2020 13:43:56 +0000 (14:43 +0100)
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
Fixes: c8e6ceecebc1 ("examples/ioat: add new sample app for ioat driver")
Cc: stable@dpdk.org
Signed-off-by: Praveen Shetty <praveen.shetty@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
examples/ioat/ioatfwd.c

index e911771..b39a098 100644 (file)
@@ -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);
        fflush(stdout);
-       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 &=
                dev_info.flow_type_rss_offloads;
        if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)