[v4,4/6] net/failsafe: remove check around pthread_mutex_init()

Message ID 20250114075033.2027286-5-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: Gaetan Rivet <grive@u256.net>
Signed-off-by: Ariel Otilibili <otilibil@eurecom.fr>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/failsafe/failsafe.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
  

Patch

diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 32811403b4c8..3e590d38f71a 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -147,12 +147,8 @@  fs_mutex_init(struct fs_priv *priv)
 		ERROR("Cannot set mutex type - %s", strerror(ret));
 		return ret;
 	}
-	ret = pthread_mutex_init(&priv->hotplug_mutex, &attr);
-	if (ret) {
-		ERROR("Cannot initiate mutex - %s", strerror(ret));
-		return ret;
-	}
-	return 0;
+
+	return pthread_mutex_init(&priv->hotplug_mutex, &attr);
 }
 
 static int