diff mbox series

net/bonding: check return value in bond_ethdev_configure

Message ID 1542380067-140320-1-git-send-email-lee.daly@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers show
Series net/bonding: check return value in bond_ethdev_configure | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Daly, Lee Nov. 16, 2018, 2:54 p.m. UTC
This patch checks the return value of function
rte_eth_bond_8023ad_agg_selection_set() in bond_ethdev_configure
for error return value.

Signed-off-by: Lee Daly <lee.daly@intel.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Ferruh Yigit Nov. 16, 2018, 3:43 p.m. UTC | #1
On 11/16/2018 2:54 PM, Lee Daly wrote:
> This patch checks the return value of function
> rte_eth_bond_8023ad_agg_selection_set() in bond_ethdev_configure
> for error return value.

Thanks Lee, just a few minor syntax comment below.

> 
> Signed-off-by: Lee Daly <lee.daly@intel.com>
> ---
>  drivers/net/bonding/rte_eth_bond_pmd.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index 156f31c..a7612ae 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -3420,9 +3420,14 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
>  				     "Failed to parse agg selection mode for bonded device %s",
>  				     name);
>  		}
> -		if (internals->mode == BONDING_MODE_8023AD)
> -			rte_eth_bond_8023ad_agg_selection_set(port_id,
> -							      agg_mode);
> +		if (internals->mode == BONDING_MODE_8023AD) {
> +			if (rte_eth_bond_8023ad_agg_selection_set(port_id,
> +							      agg_mode) < 0) {

It it clear if you extract the function out of if() and check return type in if()

> +				RTE_BOND_LOG(ERR, "Invalid args for agg selection"
> +					     " set for bonded device %s", name);

You can merge the error msg, it is accepted to go beyond 80 chars for msgs.

> +				return -1;
> +			}
> +		}
>  	}
>  
>  	/* Parse/add slave ports to bonded device */
>
diff mbox series

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 156f31c..a7612ae 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -3420,9 +3420,14 @@  bond_ethdev_configure(struct rte_eth_dev *dev)
 				     "Failed to parse agg selection mode for bonded device %s",
 				     name);
 		}
-		if (internals->mode == BONDING_MODE_8023AD)
-			rte_eth_bond_8023ad_agg_selection_set(port_id,
-							      agg_mode);
+		if (internals->mode == BONDING_MODE_8023AD) {
+			if (rte_eth_bond_8023ad_agg_selection_set(port_id,
+							      agg_mode) < 0) {
+				RTE_BOND_LOG(ERR, "Invalid args for agg selection"
+					     " set for bonded device %s", name);
+				return -1;
+			}
+		}
 	}
 
 	/* Parse/add slave ports to bonded device */