If device does not support reading registers then call to
rte_eth_dev_get_reg_info will return an error.
This fixes compiler warning when warn unused result is set.

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 examples/ethtool/lib/rte_ethtool.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/examples/ethtool/lib/rte_ethtool.c 
b/examples/ethtool/lib/rte_ethtool.c
index edc28d5c63..0b88a27e7d 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -53,10 +53,8 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct 
ethtool_drvinfo *drvinfo)
                sizeof(drvinfo->bus_info));
 
        memset(&reg_info, 0, sizeof(reg_info));
-       rte_eth_dev_get_reg_info(port_id, &reg_info);
-       n = reg_info.length;
-       if (n > 0)
-               drvinfo->regdump_len = n;
+       if (rte_eth_dev_get_reg_info(port_id, &reg_info) == 0)
+               drvinfo->regdump_len = reg_info.length;
        else
                drvinfo->regdump_len = 0;
 
-- 
2.45.2

Reply via email to