[v2,14/54] net/failsafe: check status of getting ethdev info

Message ID 1567519051-28189-15-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.ru>

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/failsafe according to its new return type.

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

Comments

Gaëtan Rivet Sept. 3, 2019, 2:20 p.m. UTC | #1
Hello Andrew, Ivan,

I would have found more consistent merging this patch with the main
ethdev one. It is short enough, I'm not sure this warrants a patch on
its own.

In any case,
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>

On Tue, Sep 03, 2019 at 02:56:48PM +0100, Andrew Rybchenko wrote:
> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> 
> 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/failsafe according to its new return type.
> 
> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  drivers/net/failsafe/failsafe_ops.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
> index 96e05d4..b3df626 100644
> --- a/drivers/net/failsafe/failsafe_ops.c
> +++ b/drivers/net/failsafe/failsafe_ops.c
> @@ -866,6 +866,7 @@
>  {
>  	struct sub_device *sdev;
>  	uint8_t i;
> +	int ret;
>  
>  	/* Use maximum upper bounds by default */
>  	infos->max_rx_pktlen = UINT32_MAX;
> @@ -933,7 +934,9 @@
>  	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
>  		struct rte_eth_dev_info sub_info;
>  
> -		rte_eth_dev_info_get(PORT_ID(sdev), &sub_info);
> +		ret = rte_eth_dev_info_get(PORT_ID(sdev), &sub_info);
> +		if (ret != 0)
> +			return;
>  
>  		fs_dev_merge_info(infos, &sub_info);
>  	}
> -- 
> 1.8.3.1
>
  

Patch

diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index 96e05d4..b3df626 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -866,6 +866,7 @@ 
 {
 	struct sub_device *sdev;
 	uint8_t i;
+	int ret;
 
 	/* Use maximum upper bounds by default */
 	infos->max_rx_pktlen = UINT32_MAX;
@@ -933,7 +934,9 @@ 
 	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
 		struct rte_eth_dev_info sub_info;
 
-		rte_eth_dev_info_get(PORT_ID(sdev), &sub_info);
+		ret = rte_eth_dev_info_get(PORT_ID(sdev), &sub_info);
+		if (ret != 0)
+			return;
 
 		fs_dev_merge_info(infos, &sub_info);
 	}