[v4,05/54] kni: check status of getting ethdev info

Message ID 1568306586-27831-6-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: change rte_eth_dev_info_get() return value to int |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andrew Rybchenko Sept. 12, 2019, 4:42 p.m. UTC
  From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>

rte_eth_dev_info_get() return value was changed from void to int,
so this patch modify rte_eth_dev_info_get() usage across
app/test/test_kni.c according to its new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test/test_kni.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
  

Patch

diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 7a65de179..2c333748d 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -436,7 +436,13 @@  test_kni_processing(uint16_t port_id, struct rte_mempool *mp)
 	memset(&info, 0, sizeof(info));
 	memset(&ops, 0, sizeof(ops));
 
-	rte_eth_dev_info_get(port_id, &info);
+	ret = rte_eth_dev_info_get(port_id, &info);
+	if (ret != 0) {
+		printf("Error during getting device (port %u) info: %s\n",
+				port_id, strerror(-ret));
+		return -1;
+	}
+
 	if (info.device)
 		bus = rte_bus_find_by_device(info.device);
 	if (bus && !strcmp(bus->name, "pci")) {
@@ -622,7 +628,14 @@  test_kni(void)
 	memset(&info, 0, sizeof(info));
 	memset(&conf, 0, sizeof(conf));
 	memset(&ops, 0, sizeof(ops));
-	rte_eth_dev_info_get(port_id, &info);
+
+	ret = rte_eth_dev_info_get(port_id, &info);
+	if (ret != 0) {
+		printf("Error during getting device (port %u) info: %s\n",
+				port_id, strerror(-ret));
+		return -1;
+	}
+
 	if (info.device)
 		bus = rte_bus_find_by_device(info.device);
 	else
@@ -658,7 +671,15 @@  test_kni(void)
 	memset(&conf, 0, sizeof(conf));
 	memset(&info, 0, sizeof(info));
 	memset(&ops, 0, sizeof(ops));
-	rte_eth_dev_info_get(port_id, &info);
+
+	ret = rte_eth_dev_info_get(port_id, &info);
+	if (ret != 0) {
+		printf("Error during getting device (port %u) info: %s\n",
+				port_id, strerror(-ret));
+		ret = -1;
+		goto fail;
+	}
+
 	if (info.device)
 		bus = rte_bus_find_by_device(info.device);
 	else