[PATCH] i40e: add an error code check in i40e_vsi_setup

Su Hui posted 1 patch 2 years, 1 month ago
There is a newer version of this series
drivers/net/ethernet/intel/i40e/i40e_main.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] i40e: add an error code check in i40e_vsi_setup
Posted by Su Hui 2 years, 1 month ago
check the value of 'ret' after calling 'i40e_vsi_config_rss'.

Signed-off-by: Su Hui <suhui@nfschina.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index de7fd43dc11c..9205090e5017 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -14567,6 +14567,8 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
 	if ((pf->hw_features & I40E_HW_RSS_AQ_CAPABLE) &&
 	    (vsi->type == I40E_VSI_VMDQ2)) {
 		ret = i40e_vsi_config_rss(vsi);
+		if (ret)
+			goto err_rings;
 	}
 	return vsi;
 
-- 
2.30.2
Re: [PATCH] i40e: add an error code check in i40e_vsi_setup
Posted by Dan Carpenter 2 years, 1 month ago
On Thu, Oct 19, 2023 at 04:42:42PM +0800, Su Hui wrote:
> check the value of 'ret' after calling 'i40e_vsi_config_rss'.
> 
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_main.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index de7fd43dc11c..9205090e5017 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -14567,6 +14567,8 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
>  	if ((pf->hw_features & I40E_HW_RSS_AQ_CAPABLE) &&
>  	    (vsi->type == I40E_VSI_VMDQ2)) {
>  		ret = i40e_vsi_config_rss(vsi);
> +		if (ret)
> +			goto err_rings;

This function uses Come From label names.  Instead of telling you what
the function/goto does it tells you where it is called from.  Here
"err_rings" means that the rings allocation failed.  However, the rings
allocation actually succeeded and we need to free it
with i40e_vsi_clear_rings().

What clean up we need to do depends on vsi->type as well but here
we know the type is vsi->type == I40E_VSI_VMDQ2 so it's needs to call
the i40e_vsi_clear_rings().

regards,
dan carpenter