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 32C5046080; Tue, 14 Jan 2025 08:50:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 043C54025F; Tue, 14 Jan 2025 08:50:43 +0100 (CET) Received: from mail-lf1-f99.google.com (mail-lf1-f99.google.com [209.85.167.99]) by mails.dpdk.org (Postfix) with ESMTP id A1DE1400EF for ; Tue, 14 Jan 2025 08:50:41 +0100 (CET) Received: by mail-lf1-f99.google.com with SMTP id 2adb3069b0e04-53f757134cdso5147963e87.2 for ; Mon, 13 Jan 2025 23:50:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736841041; x=1737445841; 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=/Hc3VIFMjiNBmXVLGxvkA3FuSnrLO3GDTWK4irHgu/k=; b=TgxUVLLnlOeOaWldBmXY5sLES0JSRTnhW3WOpPVnaee0kF+WQEzq87LpVW1RwQdcnQ 4LUzepz77nF9JuP0htEJUeZdhdzX/9nh/eyyou2uwzshH9UK+vbkQqds4SOS5+4DJ4Vv 989e/NJFCKVT4qqdD8G0eq23cPIWf/Ra6+CXtPgEr/lQGWnskc5HSi4jxoaFtUqavVfo 4/42i6IZkLo6bfDq1Prtt+l2hVsjV7rWUOhLkl8VpTGrO1j0ZFRgRYe7XJflX/jwzaHY KqTihLwFWI4P+aCA9QdzEMe5SWxtn9ojGqxBBr1w1+kI+1FGlty9w1i1L/tWmsS0Aia8 LrGg== X-Gm-Message-State: AOJu0Yz4Y9R39a5TMkpi8HD/cQOU7Nix1HrJJnM0kjTvent8d5CafNED a5y+lM3BnT77mS3nLfc4AGQ0bYxOZOEmyei03dxQu47AMov7bj5NeUKIDE7ykFj3HgTwXtPyNja bJJSgXtPw7Jqwvz4815alSWglvquZqiOh X-Gm-Gg: ASbGncuOFiz1cCe0LtISfSOaDw4mv3jsOnKHJkvRfGO5xOeDyKA+ByKfCpTzHeZQKHS PC8HQ6oBAdSESo2AxjA2IAopY+oHgsb7wlnG6GdAazJ43LGbquhNi/XcTUzWrK7XyAilw226imZ pts6Il3KOuju37B7SF18+yaKO8a4o46mveWKn3vmzKTuR6DDabkhKehZ8koc5ZKD+/fUIPm62vt 5wmiZzH8VhMIh9Fw+isWS4HpugsVatEYMZd3pip1bkGFjdwNAj1LtKC+baT3BMvCFKoKxGdWjgJ FRv24/yjG8CenHPpNNgcduOOPg== X-Google-Smtp-Source: AGHT+IG9wT42aRAqrKD0IzL1A+C59gqGSdX+c9rEEwUAOxYkiSZqNK/StWAdLIsvUy2z2LfbW5WOT28fstA2 X-Received: by 2002:a05:6512:159b:b0:541:3587:9d45 with SMTP id 2adb3069b0e04-542845b1b7dmr6178680e87.4.1736841040914; Mon, 13 Jan 2025 23:50:40 -0800 (PST) Received: from smtpservice.6wind.com ([185.13.181.2]) by smtp-relay.gmail.com with ESMTP id 2adb3069b0e04-5428be43abesm430247e87.63.2025.01.13.23.50.40; Mon, 13 Jan 2025 23:50:40 -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 83CC810279; Tue, 14 Jan 2025 08:50:40 +0100 (CET) From: Ariel Otilibili To: dev@dpdk.org Cc: Stephen Hemminger , Thomas Monjalon , David Marchand , Ariel Otilibili , Maxime Coquelin , Chenbo Xia , Ziyang Xuan , Xiaoyun Wang , Gaetan Rivet , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra , Ajit Khaparde , Somnath Kotur , Rosen Xu Subject: [PATCH v4 0/6] remove check around pthread_mutex_init() Date: Tue, 14 Jan 2025 08:50:27 +0100 Message-Id: <20250114075033.2027286-1-otilibil@eurecom.fr> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20250112185842.9752-1-otilibil@eurecom.fr> References: <20250112185842.9752-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 Hello, This series addresses Bugzilla ID 1586; the man says > pthread_mutex_init always returns 0. The other mutex functions > return 0 on success and a non-zero error code on error. Meaning, the check around around pthread_mutex_init() is needless. ``` $ git grep -Pn '=\s?pthread_mutex_init\(' drivers/common/cnxk/roc_bphy_cgx.c:197: ret = pthread_mutex_init(&roc_cgx->lock, NULL); drivers/net/bnxt/bnxt_ethdev.c:5826: err = pthread_mutex_init(&bp->flow_lock, NULL); drivers/net/bnxt/bnxt_ethdev.c:5832: err = pthread_mutex_init(&bp->def_cp_lock, NULL); drivers/net/bnxt/bnxt_ethdev.c:5838: err = pthread_mutex_init(&bp->health_check_lock, NULL); drivers/net/bnxt/bnxt_ethdev.c:5844: err = pthread_mutex_init(&bp->err_recovery_lock, NULL); drivers/net/bnxt/bnxt_ethdev.c:6773: rc = pthread_mutex_init(&bp->rep_info->vfr_start_lock, NULL); drivers/net/bnxt/bnxt_txq.c:201: rc = pthread_mutex_init(&txq->txq_lock, NULL); drivers/net/bnxt/tf_ulp/bnxt_ulp.c:218: rc = pthread_mutex_init(&session->bnxt_ulp_mutex, NULL); drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c:1475: rc = pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL); drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c:996: rc = pthread_mutex_init(&bp->ulp_ctx->cfg_data->flow_db_lock, NULL); drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c:132: rc = pthread_mutex_init(&ulp_fc_info->fc_lock, NULL); drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c:415: rc = pthread_mutex_init(&ha_info->ha_lock, NULL); drivers/net/failsafe/failsafe.c:150: ret = pthread_mutex_init(&priv->hotplug_mutex, &attr); drivers/net/hinic/base/hinic_compat.h:205: err = pthread_mutex_init(pthreadmutex, mattr); drivers/raw/ifpga/base/opae_intel_max10.c:1489: ret = pthread_mutex_init(&dev->bmc_ops.lock, NULL); drivers/raw/ifpga/base/opae_spi_transaction.c:510: ret = pthread_mutex_init(&spi_tran_dev->lock, NULL); lib/vhost/socket.c:501: ret = pthread_mutex_init(&reconn_list.mutex, NULL); lib/vhost/socket.c:924: ret = pthread_mutex_init(&vsocket->conn_mutex, NULL); ``` Thank you, Link: https://man7.org/linux/man-pages/man3/pthread_mutex_lock.3.html Bugzilla ID: 1586 Series-Acked-by: Stephen Hemminger --- v4 * addressed feedback, turned returns into tail calls * reworded the cover letter v3 (https://inbox.dpdk.org/dev/20250112202021.179634-1-otilibil@eurecom.fr/) * fix style issues v2 (https://inbox.dpdk.org/dev/20250112193043.67372-1-otilibil@eurecom.fr/) * fix build issues v1 (https://inbox.dpdk.org/dev/20250112185842.9752-1-otilibil@eurecom.fr/#t) Ariel Otilibili (6): raw/ifpga: remove check around pthread_mutex_init() net/bnxt: remove check around pthread_mutex_init() common/cnxk: remove check around pthread_mutex_init() net/failsafe: remove check around pthread_mutex_init() net/hinic: remove check around pthread_mutex_init() lib/vhost: remove check around pthread_mutex_init() drivers/common/cnxk/roc_bphy_cgx.c | 5 +-- 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 +-- drivers/net/failsafe/failsafe.c | 8 +--- drivers/net/hinic/base/hinic_compat.h | 8 +--- drivers/raw/ifpga/base/opae_intel_max10.c | 5 +-- drivers/raw/ifpga/base/opae_spi_transaction.c | 7 +--- lib/vhost/socket.c | 14 +------ 13 files changed, 21 insertions(+), 105 deletions(-) -- 2.30.2