diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html
index 0a8233775c..47cb387d30 100644
--- a/Documentation/NuttxUserGuide.html
+++ b/Documentation/NuttxUserGuide.html
@@ -3697,7 +3697,7 @@ semaphores must be less than or equal to SEM_VALUE_MAX
(defined in
Returned Value:
ERROR
) if unsuccessful.
+SEM_FAILED
if unsuccessful.
diff --git a/drivers/wireless/cc3000/cc3000drv.c b/drivers/wireless/cc3000/cc3000drv.c index ab114c0515..6327371a47 100644 --- a/drivers/wireless/cc3000/cc3000drv.c +++ b/drivers/wireless/cc3000/cc3000drv.c @@ -192,7 +192,7 @@ static void *unsoliced_thread_func(void *parameter) DEBUGASSERT(SEM_NAMELEN == QUEUE_NAMELEN); snprintf(buff, SEM_NAMELEN, SEM_FORMAT, minor); spiconf.done = sem_open(buff, O_RDONLY); - DEBUGASSERT(spiconf.done != (sem_t *)-1); + DEBUGASSERT(spiconf.done != SEM_FAILED); sem_post(&spiconf.unsoliced_thread_wakesem); diff --git a/fs/semaphore/sem_open.c b/fs/semaphore/sem_open.c index aad94091b1..4055b66ba7 100644 --- a/fs/semaphore/sem_open.c +++ b/fs/semaphore/sem_open.c @@ -94,7 +94,7 @@ * SEM_VALUE_MAX. * * Return Value: - * A pointer to sem_t or -1 (ERROR) if unsuccessful. + * A pointer to sem_t or SEM_FAILED if unsuccessful. * * Assumptions: * @@ -257,7 +257,7 @@ errout_with_lock: RELEASE_SEARCH(&desc); set_errno(errcode); sched_unlock(); - return (FAR sem_t *)ERROR; + return SEM_FAILED; } #endif /* CONFIG_FS_NAMED_SEMAPHORES */ diff --git a/include/semaphore.h b/include/semaphore.h index e14b1aa409..9a87461edf 100644 --- a/include/semaphore.h +++ b/include/semaphore.h @@ -49,6 +49,10 @@ * Pre-processor Definitions ****************************************************************************/ +/* Value returned by sem_open() in the event of a failure. */ + +#define SEM_FAILED ((FAR sem_t *)NULL) + /* Bit definitions for the struct sem_s flags field */ #define PRIOINHERIT_FLAGS_DISABLE (1 << 0) /* Bit 0: Priority inheritance