Ouss4 commented on a change in pull request #4782: URL: https://github.com/apache/incubator-nuttx/pull/4782#discussion_r745570582
########## File path: mm/mm_heap/mm_sem.c ########## @@ -102,7 +103,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()) Review comment: It looks like this path is also taken when `CONFIG_DEBUG_MM` is disabled and we are in an interrupt context. Maybe if we pull the interrupt handling aside the code would look simpler, like: ```c #if (defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__))) /* Check current environment */ if (up_interrupt_context()) { # ifdef CONFIG_DEBUG_MM return _SEM_TRYWAIT(&heap->mm_semaphore) >= 0; # else /* Can't take semaphore in the interrupt handler */ return false; #endif } else #endif ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org