[1/2] net/bnxt: log failure for switch domain free

Message ID 20201030070304.22318-1-somnath.kotur@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series [1/2] net/bnxt: log failure for switch domain free |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Somnath Kotur Oct. 30, 2020, 7:03 a.m. UTC
  Check and log an error message if switch domain free API fails

Coverity issue: 362757

Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure")
Cc: stable@dpdk.org

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
  

Comments

Ajit Khaparde Nov. 1, 2020, 3:18 a.m. UTC | #1
On Fri, Oct 30, 2020 at 12:11 AM Somnath Kotur
<somnath.kotur@broadcom.com> wrote:
>
> Check and log an error message if switch domain free API fails
>
> Coverity issue: 362757
>
> Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure")
> Cc: stable@dpdk.org
>
> Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
> Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Patch applied to dpdk-next-net-brcm.

> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index b2f72ea..31e94f2 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -1343,8 +1343,14 @@ static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)
>
>  static void bnxt_free_switch_domain(struct bnxt *bp)
>  {
> -       if (bp->switch_domain_id)
> -               rte_eth_switch_domain_free(bp->switch_domain_id);
> +       int rc = 0;
> +
> +       if (bp->switch_domain_id) {
> +               rc = rte_eth_switch_domain_free(bp->switch_domain_id);
> +               if (rc)
> +                       PMD_DRV_LOG(ERR, "free switch domain:%d fail: %d\n",
> +                                   bp->switch_domain_id, rc);
> +       }
>  }
>
>  /* Unload the driver, release resources */
> --
> 2.7.4
>
  

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b2f72ea..31e94f2 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1343,8 +1343,14 @@  static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)
 
 static void bnxt_free_switch_domain(struct bnxt *bp)
 {
-	if (bp->switch_domain_id)
-		rte_eth_switch_domain_free(bp->switch_domain_id);
+	int rc = 0;
+
+	if (bp->switch_domain_id) {
+		rc = rte_eth_switch_domain_free(bp->switch_domain_id);
+		if (rc)
+			PMD_DRV_LOG(ERR, "free switch domain:%d fail: %d\n",
+				    bp->switch_domain_id, rc);
+	}
 }
 
 /* Unload the driver, release resources */