diff options
| author | Stephen Hemminger <[email protected]> | 2024-10-04 09:21:54 -0700 |
|---|---|---|
| committer | Thomas Monjalon <[email protected]> | 2024-11-11 16:20:11 +0100 |
| commit | d0974e07f42e12626ee78cba0d285090de40d149 (patch) | |
| tree | b76d38185c1de59bd230847e3fd4df6f1f10adfb /examples | |
| parent | 07e4dc04d99a99699d71a0a39dd2a7034049e663 (diff) | |
examples/pipeline: check info query return
The rte_eth_dev_info_get and rte_eth_link_get functions may return
an error, and in that case the information structure is undefined.
The port is valid check is not needed, that can be handled by
rte_eth_dev_info_get checks.
Signed-off-by: Stephen Hemminger <[email protected]>
Acked-by: Morten Brørup <[email protected]>
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/pipeline/cli.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 015717cb39..215b4061d5 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -390,14 +390,15 @@ ethdev_show(uint16_t port_id, char **out, size_t *out_size) uint32_t length; uint16_t mtu = 0; - if (!rte_eth_dev_is_valid_port(port_id)) + if (rte_eth_dev_info_get(port_id, &info) != 0) + return; + + if (rte_eth_link_get(port_id, &link) != 0) return; rte_eth_dev_get_name_by_port(port_id, name); - rte_eth_dev_info_get(port_id, &info); rte_eth_stats_get(port_id, &stats); rte_eth_macaddr_get(port_id, &addr); - rte_eth_link_get(port_id, &link); rte_eth_dev_get_mtu(port_id, &mtu); snprintf(*out, *out_size, |
