Merge branch 'bugfix/pvs_studio_freertos' into 'master'

freertos: fix errors reported by PVS-Studio

Closes IDF-2784

See merge request espressif/esp-idf!12337
This commit is contained in:
Angus Gratton
2021-02-11 15:32:18 +08:00
3 changed files with 12 additions and 32 deletions

View File

@@ -1,3 +1,8 @@
idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS . ../private_include
PRIV_REQUIRES cmock test_utils esp_event driver)
if(CONFIG_IDF_TARGET_ARCH_RISCV)
# Temporary workaround for a linker issue on RISC-V that should be resolved in binutils 2.35 (internal ref: GCC-101)
target_compile_options(${COMPONENT_LIB} PRIVATE -mno-relax)
endif()

View File

@@ -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 );
@@ -256,15 +255,8 @@ BaseType_t xTimeoutOccurred = pdFALSE;
taskEXIT_CRITICAL( &pxEventBits->eventGroupMux );
if( xTicksToWait != ( TickType_t ) 0 )
{
if( xAlreadyYielded == pdFALSE )
{
portYIELD_WITHIN_API();
}
else
{
mtCOVERAGE_TEST_MARKER();
}
/* 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

View File

@@ -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,17 +1470,9 @@ 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 )
{
/* Force a reschedule, we may have put ourselves to sleep. */
portYIELD_WITHIN_API();
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
#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,17 +1505,10 @@ 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 )
{
/* Force a reschedule, we may have put ourselves to sleep. */
portYIELD_WITHIN_API();
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
#endif /* INCLUDE_vTaskDelay */
/*-----------------------------------------------------------*/