diff --git a/libs/libc/semaphore/sem_trywait.c b/libs/libc/semaphore/sem_trywait.c index 4cd4b1c59c2..87e3fb8d55a 100644 --- a/libs/libc/semaphore/sem_trywait.c +++ b/libs/libc/semaphore/sem_trywait.c @@ -106,13 +106,12 @@ int sem_trywait(FAR sem_t *sem) int nxsem_trywait(FAR sem_t *sem) { - DEBUGASSERT(sem != NULL); - /* This API should not be called from the idleloop or interrupt */ #if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) - DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask() || - up_interrupt_context()); + DEBUGASSERT(sem != NULL); + DEBUGASSERT(!up_interrupt_context()); + DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask()); #endif /* We don't do atomic fast path in case of LIBC_ARCH_ATOMIC because that diff --git a/libs/libc/semaphore/sem_wait.c b/libs/libc/semaphore/sem_wait.c index 77e03377d61..0c56db9d962 100644 --- a/libs/libc/semaphore/sem_wait.c +++ b/libs/libc/semaphore/sem_wait.c @@ -134,13 +134,12 @@ errout_with_cancelpt: int nxsem_wait(FAR sem_t *sem) { - DEBUGASSERT(sem != NULL); - /* This API should not be called from the idleloop or interrupt */ #if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) - DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask() || - up_interrupt_context()); + DEBUGASSERT(sem != NULL); + DEBUGASSERT(!up_interrupt_context()); + DEBUGASSERT(!OSINIT_IDLELOOP() || !sched_idletask()); #endif /* We don't do atomic fast path in case of LIBC_ARCH_ATOMIC because that