From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D013246061; Sun, 12 Jan 2025 21:20:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 94A5C40654; Sun, 12 Jan 2025 21:20:38 +0100 (CET) Received: from mail-ej1-f100.google.com (mail-ej1-f100.google.com [209.85.218.100]) by mails.dpdk.org (Postfix) with ESMTP id C03A540430 for ; Sun, 12 Jan 2025 21:20:36 +0100 (CET) Received: by mail-ej1-f100.google.com with SMTP id a640c23a62f3a-aa684b6d9c7so649966366b.2 for ; Sun, 12 Jan 2025 12:20:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736713236; x=1737318036; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DtgR18t8MeDEJPEx8snwQ9o9j4AsfYaAQr6vPswtt70=; b=aV51onZ5ONiq49sEZiJElHyABP4q33A6pHkHnYV0aeQanbG+QZQuDimVvO+AdRGlGE Ub8EWyZah8pqGUsALzKoCv8iinE5vqk/NKOgTvmJ9gHA8FqQ+CErTsl81AHJ9/Br1Owk PjrNcaMuPILxUClQPitDLztGTBepPngkhq0WKxQ5ZPPfYfbIKVkT4gGg65lL2/5XyBxR I3wEfpY6zAHvCa1pP4rfI/gbIoMfoM0pkxYJqY0THEyKfjnPAA//Kit2flmpTWYc6mX8 R+7vGBEUTFhxfFaDYqzXdsw4FBDJq3hI3n51Fb6zcxWbL2wRDfafc8ZLYIHF4yDDzhkH 31Ww== X-Gm-Message-State: AOJu0YzMaJW1cTRcuWHi0qFconEd4/WYDZfe07Xg3P98b2kXQYIMyW4s xvGZcBqHqOeRngFFchvNF0mtxD7DGssyR2ryTBjwl3/BSn2q/oHRU6GajlQgVdDktSpO36C0YNn YthCuntbA8kWfRdDRAFILh3fU+PGIodm4LOCCgm/l X-Gm-Gg: ASbGnctAjglOluMVOi5qLCPh0J1YUUavMrJRziRkKVwM0OEK00FGniDBPS0BagZHA7i 6ZC0U7SUSG9AJjWCBAy5AAmB4U7miFaa0hRS36l3k45bfB4mB9d8rTcZlPlatWu5D9HG4xrprSj vZlAvScTtqrqQmTp6wu+uYGc+ytpnQ0ubx4nAVr0ixSU/jLiLSBzxMWsf/vc12qmDhMb/Eas/kF SK8O1m6zWitli5P+T6rphW9VD7mwI5036iZnSS5qAAcGgW8Z64o5AwHQzH+pco8xGWmKjI8ffzj HlQE9YcOPEQ9UV7xYfnq0VQIGg== X-Google-Smtp-Source: AGHT+IE0eSMivraZDpkUoJZRAduY+THxiH+SWCVqG0+IIXYu8QJAQRtoZv9f6bQVCNnwESMA/iQdrqqd+PDK X-Received: by 2002:a17:906:7c0f:b0:ab2:d96d:6362 with SMTP id a640c23a62f3a-ab2d96d8877mr929787366b.1.1736713236264; Sun, 12 Jan 2025 12:20:36 -0800 (PST) Received: from smtpservice.6wind.com ([185.13.181.2]) by smtp-relay.gmail.com with ESMTP id a640c23a62f3a-ab2c90d73ccsm34479466b.69.2025.01.12.12.20.36; Sun, 12 Jan 2025 12:20:36 -0800 (PST) X-Relaying-Domain: 6wind.com Received: from localhost (rainbow.dev.6wind.com [10.17.1.165]) by smtpservice.6wind.com (Postfix) with ESMTP id 257E013DDC; Sun, 12 Jan 2025 21:20:36 +0100 (CET) From: Ariel Otilibili To: dev@dpdk.org Cc: Stephen Hemminger , Thomas Monjalon , David Marchand , Ariel Otilibili Subject: [PATCH v3 2/6] net/bnxt: remove check around pthread_mutex_init() Date: Sun, 12 Jan 2025 21:20:17 +0100 Message-Id: <20250112202021.179634-3-otilibil@eurecom.fr> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20250112202021.179634-1-otilibil@eurecom.fr> References: <20250112185842.9752-1-otilibil@eurecom.fr> <20250112202021.179634-1-otilibil@eurecom.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > pthread_mutex_init always returns 0. The other mutex functions > return 0 on success and a non-zero error code on error. Link: https://man7.org/linux/man-pages/man3/pthread_mutex_lock.3.html Bugzilla ID: 1586 Signed-off-by: Ariel Otilibili --- drivers/net/bnxt/bnxt_ethdev.c | 40 ++++++-------------------- drivers/net/bnxt/bnxt_txq.c | 6 +--- drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 8 +----- drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c | 6 +--- drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c | 6 +--- drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c | 6 +--- drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c | 6 +--- 7 files changed, 14 insertions(+), 64 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index ef8a928c9170..3a88cdc94128 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -5821,31 +5821,12 @@ static int bnxt_get_config(struct bnxt *bp) static int bnxt_init_locks(struct bnxt *bp) { - int err; + pthread_mutex_init(&bp->flow_lock, NULL); + pthread_mutex_init(&bp->def_cp_lock, NULL); + pthread_mutex_init(&bp->health_check_lock, NULL); + pthread_mutex_init(&bp->err_recovery_lock, NULL); - err = pthread_mutex_init(&bp->flow_lock, NULL); - if (err) { - PMD_DRV_LOG_LINE(ERR, "Unable to initialize flow_lock"); - return err; - } - - err = pthread_mutex_init(&bp->def_cp_lock, NULL); - if (err) { - PMD_DRV_LOG_LINE(ERR, "Unable to initialize def_cp_lock"); - return err; - } - - err = pthread_mutex_init(&bp->health_check_lock, NULL); - if (err) { - PMD_DRV_LOG_LINE(ERR, "Unable to initialize health_check_lock"); - return err; - } - - err = pthread_mutex_init(&bp->err_recovery_lock, NULL); - if (err) - PMD_DRV_LOG_LINE(ERR, "Unable to initialize err_recovery_lock"); - - return err; + return 0; } /* This should be called after we have queried trusted VF cap */ @@ -6746,7 +6727,7 @@ static void bnxt_free_rep_info(struct bnxt *bp) static int bnxt_init_rep_info(struct bnxt *bp) { - int i = 0, rc; + int i = 0; if (bp->rep_info) return 0; @@ -6770,14 +6751,9 @@ static int bnxt_init_rep_info(struct bnxt *bp) for (i = 0; i < BNXT_MAX_CFA_CODE; i++) bp->cfa_code_map[i] = BNXT_VF_IDX_INVALID; - rc = pthread_mutex_init(&bp->rep_info->vfr_start_lock, NULL); - if (rc) { - PMD_DRV_LOG_LINE(ERR, "Unable to initialize vfr_start_lock"); - bnxt_free_rep_info(bp); - return rc; - } + pthread_mutex_init(&bp->rep_info->vfr_start_lock, NULL); - return rc; + return 0; } static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev, diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c index c8649359923f..ab561585d771 100644 --- a/drivers/net/bnxt/bnxt_txq.c +++ b/drivers/net/bnxt/bnxt_txq.c @@ -198,11 +198,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, goto err; } - rc = pthread_mutex_init(&txq->txq_lock, NULL); - if (rc != 0) { - PMD_DRV_LOG_LINE(ERR, "TxQ mutex init failed!"); - goto err; - } + pthread_mutex_init(&txq->txq_lock, NULL); return 0; err: bnxt_tx_queue_release_op(eth_dev, queue_idx); diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c index 1bfc88cf79ef..0c03ae7a8349 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c @@ -188,7 +188,6 @@ ulp_session_init(struct bnxt *bp, struct rte_pci_device *pci_dev; struct rte_pci_addr *pci_addr; struct bnxt_ulp_session_state *session; - int rc = 0; if (!bp) return NULL; @@ -215,12 +214,7 @@ ulp_session_init(struct bnxt *bp, session->pci_info.domain = pci_addr->domain; session->pci_info.bus = pci_addr->bus; memcpy(session->dsn, bp->dsn, sizeof(session->dsn)); - rc = pthread_mutex_init(&session->bnxt_ulp_mutex, NULL); - if (rc) { - BNXT_DRV_DBG(ERR, "mutex create failed\n"); - pthread_mutex_unlock(&bnxt_ulp_global_mutex); - return NULL; - } + pthread_mutex_init(&session->bnxt_ulp_mutex, NULL); STAILQ_INSERT_TAIL(&bnxt_ulp_session_list, session, next); } diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c index fa7e8fe00077..4a1ccfa2a36d 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c @@ -1472,11 +1472,7 @@ ulp_tf_init(struct bnxt *bp, goto jump_to_error; } - rc = pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL); - if (rc) { - BNXT_DRV_DBG(ERR, "Unable to initialize flow db lock\n"); - goto jump_to_error; - } + pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL); /* Initialize ulp dparms with values devargs passed */ rc = ulp_tf_dparms_init(bp, bp->ulp_ctx); diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c index 6d7ec0ffec79..508c194d0490 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c @@ -993,11 +993,7 @@ ulp_tfc_init(struct bnxt *bp, goto jump_to_error; } - rc = pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL); - if (rc) { - BNXT_DRV_DBG(ERR, "Unable to initialize flow db lock\n"); - goto jump_to_error; - } + pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL); rc = ulp_tfc_dparms_init(bp, bp->ulp_ctx, ulp_dev_id); if (rc) { diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c index 67489b76f390..f9d069f4e17e 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c @@ -129,11 +129,7 @@ ulp_fc_mgr_init(struct bnxt_ulp_context *ctxt) ulp_fc_info->fc_ops = fc_ops; ulp_fc_info->flags = flags; - rc = pthread_mutex_init(&ulp_fc_info->fc_lock, NULL); - if (rc) { - BNXT_DRV_DBG(ERR, "Failed to initialize fc mutex\n"); - goto error; - } + pthread_mutex_init(&ulp_fc_info->fc_lock, NULL); /* Add the FC info tbl to the ulp context. */ bnxt_ulp_cntxt_ptr2_fc_info_set(ctxt, ulp_fc_info); diff --git a/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c index 3c75a6b43721..7b7c10d3602e 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c +++ b/drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c @@ -412,11 +412,7 @@ ulp_ha_mgr_init(struct bnxt_ulp_context *ulp_ctx) /* Add the HA info tbl to the ulp context. */ bnxt_ulp_cntxt_ptr2_ha_info_set(ulp_ctx, ha_info); - rc = pthread_mutex_init(&ha_info->ha_lock, NULL); - if (rc) { - PMD_DRV_LOG_LINE(ERR, "Failed to initialize ha mutex"); - goto cleanup; - } + pthread_mutex_init(&ha_info->ha_lock, NULL); rc = ulp_ha_mgr_timer_start(ulp_ctx->cfg_data); if (rc) { PMD_DRV_LOG_LINE(ERR, "Unable to start timer CB"); -- 2.30.2