This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch releases/13.1
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 129105134ebc18b3984c1a1c279ecc8af44e6221
Author: rongbaichuan <[email protected]>
AuthorDate: Thu Sep 24 18:38:50 2026 +0800

    sched/semaphore: Correct the return value comment of nxsem_init/nxmutex_init
    
    nxsem_init(), nxsem_destroy(), nxmutex_init(), nxmutex_destroy(),
    nxrmutex_init() and nxrmutex_destroy() cannot fail, so promising a
    negated errno value on failure documents an error that is never returned.
    The coding standard asks the returned value description to identify all
    error values of a function, and there are none, so state that OK is
    always returned.
    
    Follows "sched/semaphore: Remove the return value check of
    nxsem_init/nxmutex_init", which removed the last checks of these values.
    
    Assisted-by: DeepSeek Harness:deepseek-flash
    Signed-off-by: rongbaichuan <[email protected]>
---
 include/nuttx/mutex.h          | 12 ++++--------
 include/nuttx/semaphore.h      |  6 ++----
 libs/libc/misc/lib_mutex.c     |  3 +--
 libs/libc/semaphore/sem_init.c |  3 +--
 sched/semaphore/sem_destroy.c  |  3 +--
 5 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/include/nuttx/mutex.h b/include/nuttx/mutex.h
index 3784d1715a2..bd870c071d0 100644
--- a/include/nuttx/mutex.h
+++ b/include/nuttx/mutex.h
@@ -110,8 +110,7 @@ void nxmutex_add_backtrace(FAR mutex_t *mutex);
  *
  * Return Value:
  *   This is an internal OS interface and should not be used by applications.
- *   It follows the NuttX internal error return policy:  Zero (OK) is
- *   returned on success.  A negated errno value is returned on failure.
+ *   Zero (OK) is always returned.
  *
  ****************************************************************************/
 
@@ -471,8 +470,7 @@ static inline_function bool nxmutex_is_locked(FAR mutex_t 
*mutex)
  *
  * Return Value:
  *   This is an internal OS interface and should not be used by applications.
- *   It follows the NuttX internal error return policy:  Zero (OK) is
- *   returned on success.  A negated errno value is returned on failure.
+ *   Zero (OK) is always returned.
  *
  ****************************************************************************/
 
@@ -735,8 +733,7 @@ static inline_function int nxmutex_setprioceiling(FAR 
mutex_t *mutex,
  *
  * Return Value:
  *   This is an internal OS interface and should not be used by applications.
- *   It follows the NuttX internal error return policy:  Zero (OK) is
- *   returned on success.  A negated errno value is returned on failure.
+ *   Zero (OK) is always returned.
  *
  ****************************************************************************/
 
@@ -757,8 +754,7 @@ static inline_function int nxrmutex_init(FAR rmutex_t 
*rmutex)
  *
  * Return Value:
  *   This is an internal OS interface and should not be used by applications.
- *   It follows the NuttX internal error return policy:  Zero (OK) is
- *   returned on success.  A negated errno value is returned on failure.
+ *   Zero (OK) is always returned.
  *
  ****************************************************************************/
 
diff --git a/include/nuttx/semaphore.h b/include/nuttx/semaphore.h
index 4178a51b474..753186712d2 100644
--- a/include/nuttx/semaphore.h
+++ b/include/nuttx/semaphore.h
@@ -158,8 +158,7 @@ extern "C"
  *
  * Returned Value:
  *   This is an internal OS interface and should not be used by applications.
- *   It follows the NuttX internal error return policy:  Zero (OK) is
- *   returned on success.  A negated errno value is returned on failure.
+ *   Zero (OK) is always returned.
  *
  ****************************************************************************/
 
@@ -184,8 +183,7 @@ int nxsem_init(FAR sem_t *sem, int pshared, int32_t value);
  *
  * Returned Value:
  *   This is an internal OS interface and should not be used by applications.
- *   It follows the NuttX internal error return policy:  Zero (OK) is
- *   returned on success.  A negated errno value is returned on failure.
+ *   Zero (OK) is always returned.
  *
  ****************************************************************************/
 
diff --git a/libs/libc/misc/lib_mutex.c b/libs/libc/misc/lib_mutex.c
index 37e5a06c60d..32bbe029ff8 100644
--- a/libs/libc/misc/lib_mutex.c
+++ b/libs/libc/misc/lib_mutex.c
@@ -77,8 +77,7 @@ void nxmutex_add_backtrace(FAR mutex_t *mutex)
  *
  * Return Value:
  *   This is an internal OS interface and should not be used by applications.
- *   It follows the NuttX internal error return policy:  Zero (OK) is
- *   returned on success.  A negated errno value is returned on failure.
+ *   Zero (OK) is always returned.
  *
  ****************************************************************************/
 
diff --git a/libs/libc/semaphore/sem_init.c b/libs/libc/semaphore/sem_init.c
index 89d100758d0..544ccde87c6 100644
--- a/libs/libc/semaphore/sem_init.c
+++ b/libs/libc/semaphore/sem_init.c
@@ -57,8 +57,7 @@
  *
  * Returned Value:
  *   This is an internal OS interface and should not be used by applications.
- *   It follows the NuttX internal error return policy:  Zero (OK) is
- *   returned on success.  A negated errno value is returned on failure.
+ *   Zero (OK) is always returned.
  *
  ****************************************************************************/
 
diff --git a/sched/semaphore/sem_destroy.c b/sched/semaphore/sem_destroy.c
index 0bb84b8c7ad..ad16acf4545 100644
--- a/sched/semaphore/sem_destroy.c
+++ b/sched/semaphore/sem_destroy.c
@@ -53,8 +53,7 @@
  *
  * Returned Value:
  *   This is an internal OS interface and should not be used by applications.
- *   It follows the NuttX internal error return policy:  Zero (OK) is
- *   returned on success.  A negated errno value is returned on failure.
+ *   Zero (OK) is always returned.
  *
  ****************************************************************************/
 

Reply via email to