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 63D8346080; Tue, 14 Jan 2025 08:51:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3B8C140657; Tue, 14 Jan 2025 08:51:02 +0100 (CET) Received: from mail-ed1-f100.google.com (mail-ed1-f100.google.com [209.85.208.100]) by mails.dpdk.org (Postfix) with ESMTP id 1664140651 for ; Tue, 14 Jan 2025 08:51:01 +0100 (CET) Received: by mail-ed1-f100.google.com with SMTP id 4fb4d7f45d1cf-5d3bbb0f09dso9351583a12.2 for ; Mon, 13 Jan 2025 23:51:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736841061; x=1737445861; 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=sy0GHqqw65KlPdUTnWKa/3Ahnc4Y/VfBkM0eB9xRyHo=; b=V/HpD4W9+ODnFkSYxF+E15V3JeBg6cNM6jx5oPFdBIUQv1hJnX9mLDWcguOHJAlXxv e/avW8uKIDP8mNVgFTn3HQj7lZWE7bDJy3Y4TmL4xfV1kgrpdrTdAcdc1KujN0zjDn8S YlO8mCQ6zoQMTjaJXWsUVvCqIqVn2WRneX21i+8xA/HO/2ywz2Y1JHHmw1JJNnl6fR2s 1d0aH1yq5RDp3lQvilScNhKmatd+3bWSIfgwCoAMQ0XZs1BZdsZCp1XTYBVp6lRKxNJF sRBDzvqLx4aCPI/Uk7Ii6KMmQ/WmapSQhwCvK9Nqq7qN8OzXX1Ou1b4SxPAww4d+5E+j oAfg== X-Gm-Message-State: AOJu0YzFpALp5IF1ZBBEM3WhNCFe9CMJCK6bqoM6/Irx4Ywhoq2TEQrN seZYk2Ka8J/sz7RMbduL5x+fVuRztUy54naqJrfKohH1gcF2sWQvgVSI3g9GKvhiY+veLV2R8aT b5xp4Xms7eQyXJp/L49TW1G2ZpMEQ7D00zV2/IVcj X-Gm-Gg: ASbGnctiory6pauViPAoiaWlWEwb8wL15wl8Z0UFehLuLFJVqkG2DHFXTl3E83fy198 fSI7G7YuzLE6wFRK2kxXJ2zVxJ1IZoA5KXwnuLfkS+8nwXUtN37miwYFD5r1S8CoYti1GjtCjN2 TGwKd+1ZWfLmiSnbHK3H8gz7HcETpb42MJYgaGPqu5ZEEnEVbr1wT2loTbHNY76AUAiH+EaZ1l0 KUH6sqrasNF3T+9AkTUbxjToFuwL0Gjx+ak9A7UB7bK5bcoTQ6ZYWiFp7huuJmkpiI0Hydz2SHH KogxQ/QMhajxO3w6EXBgJQocYQ== X-Google-Smtp-Source: AGHT+IHSjzYY0z6QHPDU0P3MEIRVNXTkqSZQ5GpqZezuEt+DRU747wpF1+ndUzjJ1a71+kl4miyS/5n8mg1C X-Received: by 2002:a17:907:940d:b0:aa6:6fa5:65b3 with SMTP id a640c23a62f3a-ab2abca94b4mr1948206266b.47.1736841060715; Mon, 13 Jan 2025 23:51:00 -0800 (PST) Received: from smtpservice.6wind.com ([185.13.181.2]) by smtp-relay.gmail.com with ESMTP id a640c23a62f3a-ab2c955ec76sm51839466b.145.2025.01.13.23.51.00; Mon, 13 Jan 2025 23:51:00 -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 90D4D1027F; Tue, 14 Jan 2025 08:51:00 +0100 (CET) From: Ariel Otilibili To: dev@dpdk.org Cc: Stephen Hemminger , Thomas Monjalon , David Marchand , Ariel Otilibili , Maxime Coquelin , Chenbo Xia Subject: [PATCH v4 6/6] lib/vhost: remove check around pthread_mutex_init() Date: Tue, 14 Jan 2025 08:50:33 +0100 Message-Id: <20250114075033.2027286-7-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: Maxime Coquelin Cc: Chenbo Xia Signed-off-by: Ariel Otilibili Acked-by: Stephen Hemminger --- 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