[PATCH 06/10] examples/ntb: always check return value
Stephen Hemminger
stephen at networkplumber.org
Fri Oct 4 18:21:53 CEST 2024
The ethdev_info is only valid if rte_eth_dev_info_get returns success.
Fixes: 5194299d6ef5 ("examples/ntb: support more functions")
Cc: xiaoyun.li at intel.com
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
examples/ntb/ntb_fwd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c
index 56c7672392..37d60208e3 100644
--- a/examples/ntb/ntb_fwd.c
+++ b/examples/ntb/ntb_fwd.c
@@ -1285,7 +1285,10 @@ main(int argc, char **argv)
eth_port_id = rte_eth_find_next(0);
if (eth_port_id < RTE_MAX_ETHPORTS) {
- rte_eth_dev_info_get(eth_port_id, ðdev_info);
+ ret = rte_eth_dev_info_get(eth_port_id, ðdev_info);
+ if (ret)
+ rte_exit(EXIT_FAILURE, "Can't get info for port %u\n", eth_port_id);
+
eth_pconf.rx_adv_conf.rss_conf.rss_hf &=
ethdev_info.flow_type_rss_offloads;
ret = rte_eth_dev_configure(eth_port_id, num_queues,
--
2.45.2
More information about the dev
mailing list