diff mbox series

[v3,07/17] net/bnxt: fix cleanup on mutex init failure

Message ID 20201209235347.16180-8-ajit.khaparde@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers show
Series fixes and refactoring changes for bnxt | expand

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Ajit Khaparde Dec. 9, 2020, 11:53 p.m. UTC
In case mutex init fails during initialization, start cleanup and
fail the initialization process.

Fixes: a73b8e939f10 ("net/bnxt: fix race between start and interrupt handler")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Lance Richardson Dec. 10, 2020, 3:42 p.m. UTC | #1
On Wed, Dec 9, 2020 at 6:56 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> In case mutex init fails during initialization, start cleanup and
> fail the initialization process.
>
> Fixes: a73b8e939f10 ("net/bnxt: fix race between start and interrupt handler")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 33358779b..0b14ca234 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -4739,8 +4739,10 @@ bnxt_init_locks(struct bnxt *bp)
>         }
>
>         err = pthread_mutex_init(&bp->def_cp_lock, NULL);
> -       if (err)
> +       if (err) {
>                 PMD_DRV_LOG(ERR, "Unable to initialize def_cp_lock\n");
> +               return err;
> +       }
>
>         err = pthread_mutex_init(&bp->health_check_lock, NULL);
>         if (err)
> --
> 2.21.1 (Apple Git-122.3)
>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>
diff mbox series

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 33358779b..0b14ca234 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4739,8 +4739,10 @@  bnxt_init_locks(struct bnxt *bp)
 	}
 
 	err = pthread_mutex_init(&bp->def_cp_lock, NULL);
-	if (err)
+	if (err) {
 		PMD_DRV_LOG(ERR, "Unable to initialize def_cp_lock\n");
+		return err;
+	}
 
 	err = pthread_mutex_init(&bp->health_check_lock, NULL);
 	if (err)