[v4,3/6] common/cnxk: remove check around pthread_mutex_init()

Message ID 20250114075033.2027286-4-otilibil@eurecom.fr (mailing list archive)
State Accepted
Delegated to: Stephen Hemminger
Headers
Series remove check around pthread_mutex_init() |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ariel Otilibili-Anieli Jan. 14, 2025, 7:50 a.m. UTC
> 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: Nithin Dabilpuram <ndabilpuram@marvell.com>
Cc: Kiran Kumar K <kirankumark@marvell.com>
Cc: Sunil Kumar Kori <skori@marvell.com>
Cc: Satha Rao <skoteshwar@marvell.com>
Cc: Harman Kalra <hkalra@marvell.com>
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/common/cnxk/roc_bphy_cgx.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
  

Patch

diff --git a/drivers/common/cnxk/roc_bphy_cgx.c b/drivers/common/cnxk/roc_bphy_cgx.c
index 4f43605e1031..882cf654743b 100644
--- a/drivers/common/cnxk/roc_bphy_cgx.c
+++ b/drivers/common/cnxk/roc_bphy_cgx.c
@@ -189,14 +189,11 @@  int
 roc_bphy_cgx_dev_init(struct roc_bphy_cgx *roc_cgx)
 {
 	uint64_t val;
-	int ret;
 
 	if (!roc_cgx || !roc_cgx->bar0_va || !roc_cgx->bar0_pa)
 		return -EINVAL;
 
-	ret = pthread_mutex_init(&roc_cgx->lock, NULL);
-	if (ret)
-		return ret;
+	pthread_mutex_init(&roc_cgx->lock, NULL);
 
 	val = roc_bphy_cgx_read(roc_cgx, 0, CGX_CMRX_RX_LMACS);
 	val = FIELD_GET(CGX_CMRX_RX_LMACS_LMACS, val);