The data in rte_eth_dev_info is undefined if rte_eth_dev_info_get
returns an error. Handle the errors the same as previous error.

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 app/graph/ethdev.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/app/graph/ethdev.c b/app/graph/ethdev.c
index cfc1b18569..b8ddf21938 100644
--- a/app/graph/ethdev.c
+++ b/app/graph/ethdev.c
@@ -219,10 +219,22 @@ ethdev_show(const char *name)
        if (rc < 0)
                return rc;
 
-       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);
+       rc = rte_eth_dev_info_get(port_id, &info);
+       if (rc < 0)
+               return rc;
+
+       rc = rte_eth_link_get(port_id, &link);
+       if (rc < 0)
+               return rc;
+
+       rc = rte_eth_stats_get(port_id, &stats);
+       if (rc < 0)
+               return rc;
+
+       rc = rte_eth_macaddr_get(port_id, &addr);
+       if (rc < 0)
+               return rc;
+
        rte_eth_dev_get_mtu(port_id, &mtu);
 
        length = strlen(conn->msg_out);
-- 
2.45.2

Reply via email to