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 4E46646061; Sun, 12 Jan 2025 21:21:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E87B540673; Sun, 12 Jan 2025 21:20:45 +0100 (CET) Received: from mail-ed1-f97.google.com (mail-ed1-f97.google.com [209.85.208.97]) by mails.dpdk.org (Postfix) with ESMTP id 0842940666 for ; Sun, 12 Jan 2025 21:20:44 +0100 (CET) Received: by mail-ed1-f97.google.com with SMTP id 4fb4d7f45d1cf-5d3f57582a2so9250120a12.1 for ; Sun, 12 Jan 2025 12:20:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736713243; x=1737318043; 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=fZzWTeW1iqQUxgUrVGgZuVoB1vhuJNzFLz3ioLqO0f0=; b=RAum5/V69Ww0zsuDVa/8DXWBxijr7yjtOd88vJWtSgygiwnjNoH6o82oyJdFAP5kFo RYaHDzEQ4mgjFcxmtQPeWNTEKGyP5R8vNy8PAV/ATPNQ+3ylB5s0l1juj/RJEcvQ1zWp RMfGEXDJorg4t9Q+EplbV9eODn/YoPAVVG6W3POVpZqZy5riD3SeY96FshWS4kO8ACgK VLO548jOxn7MPwwh6d6aG9goqVNHb3gGiEoilR4M//C6w+jzaowADi3JJ3OQXZ5eZJ7i VrC8hMO61W5WfIa5rF1QdVEBleW9O948A3tDoU0ZJ2T+cGqkbzgusc5EPFe41d2bc1V5 aevQ== X-Gm-Message-State: AOJu0YxWORCVSqaXkzA6qLPxpR9q5Z9odQYL+eCf4jBYnV63hJI9wZLW FXDvia1x36oBMzmhzI1Sj9fY1o3GMyYy7m4XACMcM+nkMvG59sF4nJQBS6NM+ghJHpQvLOo92zL ALNvUaem459ZXOFBvIoTHvbVQ4JZ9FwDsweYJQzso X-Gm-Gg: ASbGncvMHDKYRedcmozQmpZxEsz8HKgul/tNrC0w3Dne8fAwdENwARnaFuWPBQHtECC R9bMzajqlCK1enqSCGIZtKloDLSpe3am2EXnehMHbNhR/jFICUPyhiBtro8oc5MFUq8oSRgY+Hy TWXS1cXIpgbaySzi3DZIJiI8+sZuYCNjFF/wDbdCHoobaBP7uENQ9qoN9QiITHoV5RuKTmz+2v8 VMRrofnIPezASj972GLRWD+HVSQZoQ4swMD2bn6x+nq8m+DtuNpyHHW9Up7uIzodnl1fDSuj3dT XQ4Bp3bDe40x5a/d0Rd3c84XRg== X-Google-Smtp-Source: AGHT+IF21qa2Gb/oskipNPs4GtgeH6h4pWwZJG2Pf9BeQXGp3DSmn3cwf3IbPDdM11MxHsU+FMtaVflc9nWt X-Received: by 2002:a17:907:7252:b0:aae:e52f:3d2b with SMTP id a640c23a62f3a-ab2c3d1927fmr994971066b.28.1736713243673; Sun, 12 Jan 2025 12:20:43 -0800 (PST) Received: from smtpservice.6wind.com ([185.13.181.2]) by smtp-relay.gmail.com with ESMTP id a640c23a62f3a-ab2c95ac7ccsm34598866b.187.2025.01.12.12.20.43; Sun, 12 Jan 2025 12:20:43 -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 839EA13DE0; Sun, 12 Jan 2025 21:20:43 +0100 (CET) From: Ariel Otilibili To: dev@dpdk.org Cc: Stephen Hemminger , Thomas Monjalon , David Marchand , Ariel Otilibili Subject: [PATCH v3 6/6] lib/vhost: remove check around pthread_mutex_init() Date: Sun, 12 Jan 2025 21:20:21 +0100 Message-Id: <20250112202021.179634-7-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 --- lib/vhost/socket.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c index d29d15494c8e..531aa8adc06c 100644 --- a/lib/vhost/socket.c +++ b/lib/vhost/socket.c @@ -498,11 +498,7 @@ vhost_user_reconnect_init(void) { int ret; - ret = pthread_mutex_init(&reconn_list.mutex, NULL); - if (ret < 0) { - VHOST_CONFIG_LOG("thread", ERR, "%s: failed to initialize mutex", __func__); - return ret; - } + pthread_mutex_init(&reconn_list.mutex, NULL); TAILQ_INIT(&reconn_list.head); ret = rte_thread_create_internal_control(&reconn_tid, "vhost-reco", @@ -921,11 +917,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags) goto out; } TAILQ_INIT(&vsocket->conn_list); - ret = pthread_mutex_init(&vsocket->conn_mutex, NULL); - if (ret) { - VHOST_CONFIG_LOG(path, ERR, "failed to init connection mutex"); - goto out_free; - } + pthread_mutex_init(&vsocket->conn_mutex, NULL); if (!strncmp("/dev/vduse/", path, strlen("/dev/vduse/"))) vsocket->is_vduse = true; @@ -1034,8 +1026,6 @@ rte_vhost_driver_register(const char *path, uint64_t flags) if (pthread_mutex_destroy(&vsocket->conn_mutex)) { VHOST_CONFIG_LOG(path, ERR, "failed to destroy connection mutex"); } -out_free: - vhost_user_socket_mem_free(vsocket); out: pthread_mutex_unlock(&vhost_user.mutex); -- 2.30.2