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 3556D455D0 for ; Wed, 10 Jul 2024 10:55:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 05B1942DCD; Wed, 10 Jul 2024 10:55:46 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id 6A78E427E1; Wed, 10 Jul 2024 10:55:39 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 2CBB8200601; Wed, 10 Jul 2024 10:55:39 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id E80742005F2; Wed, 10 Jul 2024 10:55:38 +0200 (CEST) Received: from lsv03379.swis.in-blr01.nxp.com (lsv03379.swis.in-blr01.nxp.com [92.120.147.188]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 40113183487B; Wed, 10 Jul 2024 16:55:38 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena , Shreyansh Jain Cc: stable@dpdk.org, Rohit Raj , Vanshika Shukla Subject: [v5 5/8] bus/dpaa: remove redundant file descriptor check Date: Wed, 10 Jul 2024 14:25:31 +0530 Message-Id: <20240710085534.2564668-6-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240710085534.2564668-1-vanshika.shukla@nxp.com> References: <20240709100505.2476972-1-vanshika.shukla@nxp.com> <20240710085534.2564668-1-vanshika.shukla@nxp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Rohit Raj This patch removes the redundant file descriptor check Coverity issue: CID 425715 Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table") Cc: stable@dpdk.org Signed-off-by: Rohit Raj Signed-off-by: Vanshika Shukla --- drivers/bus/dpaa/base/qbman/process.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/bus/dpaa/base/qbman/process.c b/drivers/bus/dpaa/base/qbman/process.c index 59e0d641ce..2d805c5bd9 100644 --- a/drivers/bus/dpaa/base/qbman/process.c +++ b/drivers/bus/dpaa/base/qbman/process.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2011-2016 Freescale Semiconductor Inc. - * Copyright 2017,2020 NXP + * Copyright 2017,2020,2022,2024 NXP * */ #include @@ -28,15 +28,16 @@ static int check_fd(void) { int ret; - if (fd >= 0) - return 0; ret = pthread_mutex_lock(&fd_init_lock); assert(!ret); + /* check again with the lock held */ if (fd < 0) fd = open(PROCESS_PATH, O_RDWR); + ret = pthread_mutex_unlock(&fd_init_lock); assert(!ret); + return (fd >= 0) ? 0 : -ENODEV; } -- 2.25.1