DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ariel Otilibili <otilibil@eurecom.fr>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Thomas Monjalon <thomas@monjalon.net>,
	David Marchand <david.marchand@redhat.com>,
	Ariel Otilibili <otilibil@eurecom.fr>
Subject: [PATCH v2 1/6] raw/ifpga: remove check around pthread_mutex_init()
Date: Sun, 12 Jan 2025 20:30:38 +0100	[thread overview]
Message-ID: <20250112193043.67372-2-otilibil@eurecom.fr> (raw)
In-Reply-To: <20250112193043.67372-1-otilibil@eurecom.fr>

> 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 <otilibil@eurecom.fr>
---
 drivers/raw/ifpga/base/opae_intel_max10.c     |  5 +----
 drivers/raw/ifpga/base/opae_spi_transaction.c | 11 +++--------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/raw/ifpga/base/opae_intel_max10.c b/drivers/raw/ifpga/base/opae_intel_max10.c
index d5a9ceb6e355..58c884a8d8e1 100644
--- a/drivers/raw/ifpga/base/opae_intel_max10.c
+++ b/drivers/raw/ifpga/base/opae_intel_max10.c
@@ -1486,10 +1486,7 @@ intel_max10_device_init(struct intel_max10_device *dev)
 		if (ret)
 			return ret;
 
-		ret = pthread_mutex_init(&dev->bmc_ops.lock, NULL);
-		if (ret)
-			return ret;
-
+		pthread_mutex_init(&dev->bmc_ops.lock, NULL);
 		if (!dev->bmc_ops.mutex)
 			dev->bmc_ops.mutex = &dev->bmc_ops.lock;
 	}
diff --git a/drivers/raw/ifpga/base/opae_spi_transaction.c b/drivers/raw/ifpga/base/opae_spi_transaction.c
index 21015eb95ef5..49d51c7bc3ab 100644
--- a/drivers/raw/ifpga/base/opae_spi_transaction.c
+++ b/drivers/raw/ifpga/base/opae_spi_transaction.c
@@ -494,7 +494,6 @@ struct spi_transaction_dev *spi_transaction_init(struct altera_spi_device *dev,
 		int chipselect)
 {
 	struct spi_transaction_dev *spi_tran_dev;
-	int ret;
 
 	spi_tran_dev = opae_malloc(sizeof(struct spi_transaction_dev));
 	if (!spi_tran_dev)
@@ -507,11 +506,7 @@ struct spi_transaction_dev *spi_transaction_init(struct altera_spi_device *dev,
 	if (!spi_tran_dev->buffer)
 		goto err;
 
-	ret = pthread_mutex_init(&spi_tran_dev->lock, NULL);
-	if (ret) {
-		dev_err(spi_tran_dev, "fail to init mutex lock\n");
-		goto err;
-	}
+	pthread_mutex_init(&spi_tran_dev->lock, NULL);
 	if (dev->mutex) {
 		dev_info(NULL, "use multi-process mutex in spi\n");
 		spi_tran_dev->mutex = dev->mutex;
@@ -523,8 +518,8 @@ struct spi_transaction_dev *spi_transaction_init(struct altera_spi_device *dev,
 	return spi_tran_dev;
 
 err:
-	opae_free(spi_tran_dev);
-	return NULL;
+       opae_free(spi_tran_dev);
+       return NULL;
 }
 
 void spi_transaction_remove(struct spi_transaction_dev *dev)
-- 
2.30.2


  reply	other threads:[~2025-01-12 19:31 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-12 18:58 [PATCH 0/6] " Ariel Otilibili
2025-01-12 18:58 ` [PATCH 1/6] raw/ifpga: " Ariel Otilibili
2025-01-12 18:58 ` [PATCH 2/6] net/bnxt: " Ariel Otilibili
2025-01-12 18:58 ` [PATCH 3/6] common/cnxk: " Ariel Otilibili
2025-01-12 18:58 ` [PATCH 4/6] net/failsafe: " Ariel Otilibili
2025-01-12 18:58 ` [PATCH 5/6] net/hinic: " Ariel Otilibili
2025-01-12 18:58 ` [PATCH 6/6] lib/vhost: " Ariel Otilibili
2025-01-12 19:30 ` [PATCH v2 0/6] " Ariel Otilibili
2025-01-12 19:30   ` Ariel Otilibili [this message]
2025-01-12 19:30   ` [PATCH v2 2/6] net/bnxt: " Ariel Otilibili
2025-01-12 19:30   ` [PATCH v2 3/6] common/cnxk: " Ariel Otilibili
2025-01-12 19:30   ` [PATCH v2 4/6] net/failsafe: " Ariel Otilibili
2025-01-12 19:30   ` [PATCH v2 5/6] net/hinic: " Ariel Otilibili
2025-01-12 19:30   ` [PATCH v2 6/6] lib/vhost: " Ariel Otilibili
2025-01-12 20:20 ` [PATCH v3 0/6] " Ariel Otilibili
2025-01-12 20:20   ` [PATCH v3 1/6] raw/ifpga: " Ariel Otilibili
2025-01-12 20:20   ` [PATCH v3 2/6] net/bnxt: " Ariel Otilibili
2025-01-12 20:20   ` [PATCH v3 3/6] common/cnxk: " Ariel Otilibili
2025-01-12 20:20   ` [PATCH v3 4/6] net/failsafe: " Ariel Otilibili
2025-01-13 19:10     ` Stephen Hemminger
2025-01-12 20:20   ` [PATCH v3 5/6] net/hinic: " Ariel Otilibili
2025-01-13 19:09     ` Stephen Hemminger
2025-01-12 20:20   ` [PATCH v3 6/6] lib/vhost: " Ariel Otilibili
2025-01-13 19:11   ` [PATCH v3 0/6] " Stephen Hemminger
2025-01-14  8:22     ` Ariel Otilibili-Anieli
2025-01-13 17:19 ` [PATCH 0/1] eal/linux: Remove unused values Ariel Otilibili
2025-01-13 17:19   ` [PATCH 1/1] " Ariel Otilibili
2025-01-14  7:50 ` [PATCH v4 0/6] remove check around pthread_mutex_init() Ariel Otilibili
2025-01-14  7:50   ` [PATCH v4 1/6] raw/ifpga: " Ariel Otilibili
2025-01-14  7:50   ` [PATCH v4 2/6] net/bnxt: " Ariel Otilibili
2025-01-14  7:50   ` [PATCH v4 3/6] common/cnxk: " Ariel Otilibili
2025-01-14  7:50   ` [PATCH v4 4/6] net/failsafe: " Ariel Otilibili
2025-01-14  7:50   ` [PATCH v4 5/6] net/hinic: " Ariel Otilibili
2025-01-14  7:50   ` [PATCH v4 6/6] lib/vhost: " Ariel Otilibili
2025-01-14  8:48     ` Maxime Coquelin
2025-01-14 11:03       ` Ariel Otilibili-Anieli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250112193043.67372-2-otilibil@eurecom.fr \
    --to=otilibil@eurecom.fr \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).