[v2,16/54] net/softnic: check status of getting ethdev info

Message ID 1567519051-28189-17-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Superseded, 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 fail Compilation issues

Commit Message

Andrew Rybchenko Sept. 3, 2019, 1:56 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
net/softnic according to its new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/softnic/rte_eth_softnic_link.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Jasvinder Singh Sept. 9, 2019, 7:01 a.m. UTC | #1
> -----Original Message-----
> From: Andrew Rybchenko [mailto:arybchenko@solarflare.com]
> Sent: Tuesday, September 3, 2019 2:57 PM
> To: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Cc: dev@dpdk.org; Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>
> Subject: [PATCH v2 16/54] net/softnic: check status of getting ethdev info
> 
> 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 net/softnic according to its
> new return type.
> 
> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.com>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  drivers/net/softnic/rte_eth_softnic_link.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/softnic/rte_eth_softnic_link.c
> b/drivers/net/softnic/rte_eth_softnic_link.c
> index d669913..21a6406 100644
> --- a/drivers/net/softnic/rte_eth_softnic_link.c
> +++ b/drivers/net/softnic/rte_eth_softnic_link.c
> @@ -57,6 +57,7 @@ struct softnic_link *
>  	struct rte_eth_dev_info port_info;
>  	struct softnic_link *link;
>  	uint16_t port_id;
> +	int ret;
> 
>  	/* Check input params */
>  	if (name == NULL ||
> @@ -78,7 +79,9 @@ struct softnic_link *
>  			return NULL;
>  	}
> 
> -	rte_eth_dev_info_get(port_id, &port_info);
> +	ret = rte_eth_dev_info_get(port_id, &port_info);
> +	if (ret != 0)
> +		return NULL;
> 
>  	/* Node allocation */
>  	link = calloc(1, sizeof(struct softnic_link));
> --
> 1.8.3.1

Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
  

Patch

diff --git a/drivers/net/softnic/rte_eth_softnic_link.c b/drivers/net/softnic/rte_eth_softnic_link.c
index d669913..21a6406 100644
--- a/drivers/net/softnic/rte_eth_softnic_link.c
+++ b/drivers/net/softnic/rte_eth_softnic_link.c
@@ -57,6 +57,7 @@  struct softnic_link *
 	struct rte_eth_dev_info port_info;
 	struct softnic_link *link;
 	uint16_t port_id;
+	int ret;
 
 	/* Check input params */
 	if (name == NULL ||
@@ -78,7 +79,9 @@  struct softnic_link *
 			return NULL;
 	}
 
-	rte_eth_dev_info_get(port_id, &port_info);
+	ret = rte_eth_dev_info_get(port_id, &port_info);
+	if (ret != 0)
+		return NULL;
 
 	/* Node allocation */
 	link = calloc(1, sizeof(struct softnic_link));