diff --git a/mm/mm_heap/mm_initialize.c b/mm/mm_heap/mm_initialize.c index cacff9c0471..7696676fde3 100644 --- a/mm/mm_heap/mm_initialize.c +++ b/mm/mm_heap/mm_initialize.c @@ -79,12 +79,12 @@ void mm_addregion(FAR struct mm_heap_s *heap, FAR void *heapstart, # define IDX 0 #endif +#if defined(CONFIG_MM_SMALL) && !defined(CONFIG_SMALL_MEMORY) /* If the MCU handles wide addresses but the memory manager is configured * for a small heap, then verify that the caller is not doing something * crazy. */ -#if defined(CONFIG_MM_SMALL) && !defined(CONFIG_SMALL_MEMORY) DEBUGASSERT(heapsize <= MMSIZE_MAX+1); #endif diff --git a/sched/semaphore/sem_post.c b/sched/semaphore/sem_post.c index 1c904499536..47487db42a8 100644 --- a/sched/semaphore/sem_post.c +++ b/sched/semaphore/sem_post.c @@ -98,7 +98,22 @@ int sem_post(FAR sem_t *sem) flags = enter_critical_section(); - /* Perform the semaphore unlock operation. */ + /* Perform the semaphore unlock operation, releasing this task as a + * holder then also incrementing the count on the semaphore. + * + * NOTE: When semaphores are used for signaling purposes, the holder + * of the semaphore may not be this thread! In this case, + * sem_releaseholder() will do nothing. + * + * In the case of a mutex this could be simply resolved since there is + * only one holder but for the case of counting semaphores, there may + * be many holders and if the holder is not this thread, then it is + * not possible to know which thread/holder should be released. + * + * For this reason, it is recommended that priority inheritance be + * disabled via sem_setprotocol(SEM_PRIO_NONE) when the semahore is + * initialixed if the semaphore is to used for signaling purposes. + */ ASSERT(sem->semcount < SEM_VALUE_MAX); sem_releaseholder(sem);