[v4,50/54] examples/ip_pipeline: check status of getting ethdev info

Message ID 1568306586-27831-51-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:43 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
examples/ip_pipeline according to its new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 examples/ip_pipeline/kni.c  | 5 ++++-
 examples/ip_pipeline/link.c | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)
  

Patch

diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c
index e9262e079..451968593 100644
--- a/examples/ip_pipeline/kni.c
+++ b/examples/ip_pipeline/kni.c
@@ -109,6 +109,7 @@  kni_create(const char *name, struct kni_params *params)
 	struct rte_kni *k;
 	const struct rte_pci_device *pci_dev;
 	const struct rte_bus *bus = NULL;
+	int ret;
 
 	/* Check input params */
 	if ((name == NULL) ||
@@ -123,7 +124,9 @@  kni_create(const char *name, struct kni_params *params)
 		return NULL;
 
 	/* Resource create */
-	rte_eth_dev_info_get(link->port_id, &dev_info);
+	ret = rte_eth_dev_info_get(link->port_id, &dev_info);
+	if (ret != 0)
+		return NULL;
 
 	memset(&kni_conf, 0, sizeof(kni_conf));
 	strlcpy(kni_conf.name, name, RTE_KNI_NAMESIZE);
diff --git a/examples/ip_pipeline/link.c b/examples/ip_pipeline/link.c
index 787eb866a..4e3a40b5a 100644
--- a/examples/ip_pipeline/link.c
+++ b/examples/ip_pipeline/link.c
@@ -129,7 +129,8 @@  link_create(const char *name, struct link_params *params)
 		if (!rte_eth_dev_is_valid_port(port_id))
 			return NULL;
 
-	rte_eth_dev_info_get(port_id, &port_info);
+	if (rte_eth_dev_info_get(port_id, &port_info) != 0)
+		return NULL;
 
 	mempool = mempool_find(params->rx.mempool_name);
 	if (mempool == NULL)