diff --git a/mm/mm_heap/mm_sem.c b/mm/mm_heap/mm_sem.c index a4d4e869c7c..b62983a809d 100644 --- a/mm/mm_heap/mm_sem.c +++ b/mm/mm_heap/mm_sem.c @@ -75,18 +75,6 @@ void mm_seminitialize(FAR struct mm_heap_s *heap) bool mm_takesemaphore(FAR struct mm_heap_s *heap) { -#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) - /* Check current environment */ - - if (up_interrupt_context()) - { - /* Can't take semaphore in the interrupt handler */ - - return false; - } - else -#endif - /* getpid() returns the task ID of the task at the head of the ready-to- * run task list. mm_takesemaphore() may be called during context * switches. There are certain situations during context switching when @@ -102,7 +90,7 @@ bool mm_takesemaphore(FAR struct mm_heap_s *heap) return false; } #if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) - else if (sched_idletask()) + else if (sched_idletask() || up_interrupt_context()) { /* Try to take the semaphore */ diff --git a/sched/semaphore/sem_trywait.c b/sched/semaphore/sem_trywait.c index 3648aac26c1..1d973a12630 100644 --- a/sched/semaphore/sem_trywait.c +++ b/sched/semaphore/sem_trywait.c @@ -69,10 +69,6 @@ int nxsem_trywait(FAR sem_t *sem) irqstate_t flags; int ret; - /* This API should not be called from interrupt handlers */ - - DEBUGASSERT(sem != NULL && up_interrupt_context() == false); - if (sem != NULL) { /* The following operations must be performed with interrupts disabled