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 8282146080; Tue, 14 Jan 2025 08:50:55 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 56901402F0; Tue, 14 Jan 2025 08:50:54 +0100 (CET) Received: from mail-ed1-f98.google.com (mail-ed1-f98.google.com [209.85.208.98]) by mails.dpdk.org (Postfix) with ESMTP id BC23A402F0 for ; Tue, 14 Jan 2025 08:50:52 +0100 (CET) Received: by mail-ed1-f98.google.com with SMTP id 4fb4d7f45d1cf-5d96944401dso8737832a12.0 for ; Mon, 13 Jan 2025 23:50:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736841052; x=1737445852; 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=EylGfJqz3JK26KRiJ6nmLsUWnFBt+LWSPGJyFf5V4qU=; b=uf5TeM2/n07MnV7/TJCHdLEuc7xianTw7aTISxVuFEdz9W+rilaX8bRFW/AvWEjZuG CiuHmtvfQwyns6+Oz5xSOKS5aBEb8YrJ5Qyqf0MwmMlwT5NULVE3JmA/HeRJU5qmvPcV QlG20ztGXqZIWvtpE6Pntuyw6T0QTZsdBtTKRWPy2n24ZtjemIU+IhCegQ70o/hBuRLP W4TAqZdrzaqkh6Xlu4z6G5KaiBI74xSorx4cuF2nHFGdlOJi9kyxmyb/dNcED2qFljbs 3m/elrXlGjT2l4/MUKlydMuEF+1CgKlyXbW5l3WEvj63HC0ZP7H4WTx+Oa6ZSG5RqlZQ QwEg== X-Gm-Message-State: AOJu0YzC8oQDc9sYBtnE97kVqbPo1omGPKqnGatljByB1qoQ2Gu3z9Jy A97GVuRkPlreFDk96j4WHlTnby5YZkIX7/l33stusSf1l/r7y8ofE1bVgbExd3BgWU4l5/VEEv3 cIbxD/bWuBJM0+laBSdYX7n+xuZ/na79e X-Gm-Gg: ASbGncvY2SKsNf5OZ/zdCnrJwFEFe+zTkg45sTOrNeNn0EjVNvKls8MxrOlPBYB/OI7 HDwjvwTkkv2XEWF6tvTjZ1EEFv0fJw1xD5/PcBNejvd04rKwKWsSEMbGsPjCAyAIEfWEqNf1+TE EpHLD1igFFVqRHAAywFKuOrf/0vrF0Qaasu6IGx4fasdyV4HoTMXVr8Jtmm/UOJXkHqLtY9zKYh klWy/wMYelTDtm669oDsbVuVkMEuI+RmatYYjJDEivadBkDPazwr90rAG/SvZkepdMbvaEDdm+p C2RAKMgsNfQwZ/JjfncGNXZtsQ== X-Google-Smtp-Source: AGHT+IFoHCv0bbPbO8IAjtl6nxApp3KodQGCAIstOos6NnMmDO97jvDo2lqgDpkmvO8fl+bqed1XHJrRqga/ X-Received: by 2002:a05:6402:2690:b0:5d2:7199:ae5 with SMTP id 4fb4d7f45d1cf-5d972dfbe9amr22981256a12.5.1736841052225; Mon, 13 Jan 2025 23:50:52 -0800 (PST) Received: from smtpservice.6wind.com ([185.13.181.2]) by smtp-relay.gmail.com with ESMTP id 4fb4d7f45d1cf-5d99ef3bf80sm577570a12.22.2025.01.13.23.50.52; Mon, 13 Jan 2025 23:50:52 -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 115291027B; Tue, 14 Jan 2025 08:50:52 +0100 (CET) From: Ariel Otilibili To: dev@dpdk.org Cc: Stephen Hemminger , Thomas Monjalon , David Marchand , Ariel Otilibili , Ajit Khaparde , Somnath Kotur Subject: [PATCH v4 2/6] net/bnxt: remove check around pthread_mutex_init() Date: Tue, 14 Jan 2025 08:50:29 +0100 Message-Id: <20250114075033.2027286-3-otilibil@eurecom.fr> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20250114075033.2027286-1-otilibil@eurecom.fr> References: <20250112185842.9752-1-otilibil@eurecom.fr> <20250114075033.2027286-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 Cc: Ajit Khaparde Cc: Somnath Kotur Signed-off-by: Ariel Otilibili Acked-by: Stephen Hemminger --- drivers/net/bnxt/bnxt_ethdev.c | 40 +++++--------------------- drivers/net/bnxt/bnxt_txq.c | 7 +---- 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, 13 insertions(+), 66 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index ef8a928c9170..21e9aa902c68 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,7 @@ 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; - } - - return rc; + return pthread_mutex_init(&bp->rep_info->vfr_start_lock, NULL); } 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..3938ebc7091d 100644 --- a/drivers/net/bnxt/bnxt_txq.c +++ b/drivers/net/bnxt/bnxt_txq.c @@ -198,12 +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; - } - return 0; + return pthread_mutex_init(&txq->txq_lock, NULL); err: bnxt_tx_queue_release_op(eth_dev, queue_idx); return rc; 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