From c87fe77ef91d3c8f47fca03d7360d8a143fa2132 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Oct 2020 10:09:08 +1100 Subject: [PATCH] freertos: Restore the check that mutex is given by owner Even without this check, if the owner doesn't match then FreeRTOS will still fail an assertion - but it's not as clear what the root cause is. --- components/freertos/queue.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/freertos/queue.c b/components/freertos/queue.c index 4be568928c..356c93e323 100644 --- a/components/freertos/queue.c +++ b/components/freertos/queue.c @@ -770,6 +770,11 @@ Queue_t * const pxQueue = xQueue; } #endif +#if ( configUSE_MUTEXES == 1 && configCHECK_MUTEX_GIVEN_BY_OWNER == 1) + configASSERT(pxQueue->uxQueueType != queueQUEUE_IS_MUTEX + || pxQueue->u.xSemaphore.xMutexHolder == NULL + || pxQueue->u.xSemaphore.xMutexHolder == xTaskGetCurrentTaskHandle()); +#endif /*lint -save -e904 This function relaxes the coding standard somewhat to allow return statements within the function itself. This is done in the