mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
freertos: fix errors reported by PVS-Studio
Removed leftover code-paths that were never taken. Upstream freertos uses vTaskSuspendAll() and xTaskResumeAll(), and therefor check if the task already yielded. In the IDF port of freertos we use critcal sections instead, so xAlreadyYielded will never be set. Partially addresses https://github.com/espressif/esp-idf/issues/6440
This commit is contained in:
parent
a196d6d1ab
commit
d294ac381f
@ -198,7 +198,6 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t u
|
||||
{
|
||||
EventBits_t uxOriginalBitValue, uxReturn;
|
||||
EventGroup_t *pxEventBits = xEventGroup;
|
||||
BaseType_t xAlreadyYielded = pdFALSE;
|
||||
BaseType_t xTimeoutOccurred = pdFALSE;
|
||||
|
||||
configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
|
||||
@ -257,14 +256,7 @@ BaseType_t xTimeoutOccurred = pdFALSE;
|
||||
|
||||
if( xTicksToWait != ( TickType_t ) 0 )
|
||||
{
|
||||
if( xAlreadyYielded == pdFALSE )
|
||||
{
|
||||
portYIELD_WITHIN_API();
|
||||
}
|
||||
else
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
portYIELD_WITHIN_API();
|
||||
|
||||
/* The task blocked to wait for its required bits to be set - at this
|
||||
point either the required bits were set or the block time expired. If
|
||||
|
@ -1406,7 +1406,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
|
||||
void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement )
|
||||
{
|
||||
TickType_t xTimeToWake;
|
||||
BaseType_t xAlreadyYielded = pdFALSE, xShouldDelay = pdFALSE;
|
||||
BaseType_t xShouldDelay = pdFALSE;
|
||||
|
||||
configASSERT( pxPreviousWakeTime );
|
||||
configASSERT( ( xTimeIncrement > 0U ) );
|
||||
@ -1470,16 +1470,8 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
|
||||
}
|
||||
taskEXIT_CRITICAL( &xTaskQueueMutex );
|
||||
|
||||
/* Force a reschedule if xTaskResumeAll has not already done so, we may
|
||||
have put ourselves to sleep. */
|
||||
if( xAlreadyYielded == pdFALSE )
|
||||
{
|
||||
portYIELD_WITHIN_API();
|
||||
}
|
||||
else
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
/* Force a reschedule, we may have put ourselves to sleep. */
|
||||
portYIELD_WITHIN_API();
|
||||
}
|
||||
|
||||
#endif /* INCLUDE_vTaskDelayUntil */
|
||||
@ -1489,8 +1481,6 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
|
||||
|
||||
void vTaskDelay( const TickType_t xTicksToDelay )
|
||||
{
|
||||
BaseType_t xAlreadyYielded = pdFALSE;
|
||||
|
||||
/* A delay time of zero just forces a reschedule. */
|
||||
if( xTicksToDelay > ( TickType_t ) 0U )
|
||||
{
|
||||
@ -1515,18 +1505,11 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
|
||||
/* Force a reschedule if xTaskResumeAll has not already done so, we may
|
||||
have put ourselves to sleep. */
|
||||
if( xAlreadyYielded == pdFALSE )
|
||||
{
|
||||
portYIELD_WITHIN_API();
|
||||
}
|
||||
else
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
/* Force a reschedule, we may have put ourselves to sleep. */
|
||||
portYIELD_WITHIN_API();
|
||||
}
|
||||
|
||||
|
||||
#endif /* INCLUDE_vTaskDelay */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user