[dpdk-dev,v3] net/failsafe: fix failsafe bus uninit return value

Message ID 1503997688-1182-1-git-send-email-rasland@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

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

Commit Message

Raslan Darawsheh Aug. 29, 2017, 9:08 a.m. UTC
  fs_bus_uninit is always returning 0 no matter what was the status
of each sub device bus_uninit value.

Fixes: a46f8d58 ("net/failsafe: add fail-safe PMD")

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
 drivers/net/failsafe/failsafe_eal.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
  

Comments

Gaëtan Rivet Aug. 29, 2017, 9:28 a.m. UTC | #1
On Tue, Aug 29, 2017 at 12:08:08PM +0300, Raslan Darawsheh wrote:
> fs_bus_uninit is always returning 0 no matter what was the status
> of each sub device bus_uninit value.
> 
> Fixes: a46f8d58 ("net/failsafe: add fail-safe PMD")
> 

No need to send another version, but for next time: you could have
included my ack at this point :).

> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>

Thanks,

> ---
>  drivers/net/failsafe/failsafe_eal.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
> index c8f4318..aeb87a0 100644
> --- a/drivers/net/failsafe/failsafe_eal.c
> +++ b/drivers/net/failsafe/failsafe_eal.c
> @@ -90,19 +90,20 @@ fs_bus_uninit(struct rte_eth_dev *dev)
>  {
>  	struct sub_device *sdev = NULL;
>  	uint8_t i;
> -	int ret;
> +	int sdev_ret;
> +	int ret = 0;
>  
>  	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
> -		ret = rte_eal_hotplug_remove(sdev->bus->name,
> -					     sdev->dev->name);
> -		if (ret) {
> -			ERROR("Failed to remove requested device %s",
> -			      sdev->dev->name);
> +		sdev_ret = rte_eal_hotplug_remove(sdev->bus->name,
> +							sdev->dev->name);
> +		if (sdev_ret) {
> +			ERROR("Failed to remove requested device %s (err: %d)",
> +			      sdev->dev->name, sdev_ret);
>  			continue;
>  		}
>  		sdev->state = DEV_PROBED - 1;
>  	}
> -	return 0;
> +	return ret;
>  }
>  
>  int
> @@ -111,8 +112,6 @@ failsafe_eal_uninit(struct rte_eth_dev *dev)
>  	int ret;
>  
>  	ret = fs_bus_uninit(dev);
> -	if (ret)
> -		return ret;
>  	PRIV(dev)->state = DEV_PROBED - 1;
> -	return 0;
> +	return ret;
>  }
> -- 
> 2.7.4
>
  
Ferruh Yigit Aug. 30, 2017, 9:09 a.m. UTC | #2
On 8/29/2017 10:28 AM, Gaëtan Rivet wrote:
> On Tue, Aug 29, 2017 at 12:08:08PM +0300, Raslan Darawsheh wrote:
>> fs_bus_uninit is always returning 0 no matter what was the status
>> of each sub device bus_uninit value.
>>
>> Fixes: a46f8d58 ("net/failsafe: add fail-safe PMD")
Cc: stable@dpdk.org
>>
>> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index c8f4318..aeb87a0 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -90,19 +90,20 @@  fs_bus_uninit(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev = NULL;
 	uint8_t i;
-	int ret;
+	int sdev_ret;
+	int ret = 0;
 
 	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
-		ret = rte_eal_hotplug_remove(sdev->bus->name,
-					     sdev->dev->name);
-		if (ret) {
-			ERROR("Failed to remove requested device %s",
-			      sdev->dev->name);
+		sdev_ret = rte_eal_hotplug_remove(sdev->bus->name,
+							sdev->dev->name);
+		if (sdev_ret) {
+			ERROR("Failed to remove requested device %s (err: %d)",
+			      sdev->dev->name, sdev_ret);
 			continue;
 		}
 		sdev->state = DEV_PROBED - 1;
 	}
-	return 0;
+	return ret;
 }
 
 int
@@ -111,8 +112,6 @@  failsafe_eal_uninit(struct rte_eth_dev *dev)
 	int ret;
 
 	ret = fs_bus_uninit(dev);
-	if (ret)
-		return ret;
 	PRIV(dev)->state = DEV_PROBED - 1;
-	return 0;
+	return ret;
 }