Skip to content

Commit 1544f64

Browse files
committed
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
2 parents c665bcf + 4eb9cc6 commit 1544f64

File tree

3 files changed

+12
-32
lines changed

3 files changed

+12
-32
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
idf_component_register(SRC_DIRS "."
22
PRIV_INCLUDE_DIRS . ../private_include
33
PRIV_REQUIRES cmock test_utils esp_event driver)
4+
5+
if(CONFIG_IDF_TARGET_ARCH_RISCV)
6+
# Temporary workaround for a linker issue on RISC-V that should be resolved in binutils 2.35 (internal ref: GCC-101)
7+
target_compile_options(${COMPONENT_LIB} PRIVATE -mno-relax)
8+
endif()

components/freertos/event_groups.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t u
198198
{
199199
EventBits_t uxOriginalBitValue, uxReturn;
200200
EventGroup_t *pxEventBits = xEventGroup;
201-
BaseType_t xAlreadyYielded = pdFALSE;
202201
BaseType_t xTimeoutOccurred = pdFALSE;
203202

204203
configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
@@ -257,14 +256,7 @@ BaseType_t xTimeoutOccurred = pdFALSE;
257256

258257
if( xTicksToWait != ( TickType_t ) 0 )
259258
{
260-
if( xAlreadyYielded == pdFALSE )
261-
{
262-
portYIELD_WITHIN_API();
263-
}
264-
else
265-
{
266-
mtCOVERAGE_TEST_MARKER();
267-
}
259+
portYIELD_WITHIN_API();
268260

269261
/* The task blocked to wait for its required bits to be set - at this
270262
point either the required bits were set or the block time expired. If

components/freertos/tasks.c

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
14061406
void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement )
14071407
{
14081408
TickType_t xTimeToWake;
1409-
BaseType_t xAlreadyYielded = pdFALSE, xShouldDelay = pdFALSE;
1409+
BaseType_t xShouldDelay = pdFALSE;
14101410

14111411
configASSERT( pxPreviousWakeTime );
14121412
configASSERT( ( xTimeIncrement > 0U ) );
@@ -1470,16 +1470,8 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
14701470
}
14711471
taskEXIT_CRITICAL( &xTaskQueueMutex );
14721472

1473-
/* Force a reschedule if xTaskResumeAll has not already done so, we may
1474-
have put ourselves to sleep. */
1475-
if( xAlreadyYielded == pdFALSE )
1476-
{
1477-
portYIELD_WITHIN_API();
1478-
}
1479-
else
1480-
{
1481-
mtCOVERAGE_TEST_MARKER();
1482-
}
1473+
/* Force a reschedule, we may have put ourselves to sleep. */
1474+
portYIELD_WITHIN_API();
14831475
}
14841476

14851477
#endif /* INCLUDE_vTaskDelayUntil */
@@ -1489,8 +1481,6 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
14891481

14901482
void vTaskDelay( const TickType_t xTicksToDelay )
14911483
{
1492-
BaseType_t xAlreadyYielded = pdFALSE;
1493-
14941484
/* A delay time of zero just forces a reschedule. */
14951485
if( xTicksToDelay > ( TickType_t ) 0U )
14961486
{
@@ -1515,18 +1505,11 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB, TaskFunction_t pxTaskCode
15151505
mtCOVERAGE_TEST_MARKER();
15161506
}
15171507

1518-
/* Force a reschedule if xTaskResumeAll has not already done so, we may
1519-
have put ourselves to sleep. */
1520-
if( xAlreadyYielded == pdFALSE )
1521-
{
1522-
portYIELD_WITHIN_API();
1523-
}
1524-
else
1525-
{
1526-
mtCOVERAGE_TEST_MARKER();
1527-
}
1508+
/* Force a reschedule, we may have put ourselves to sleep. */
1509+
portYIELD_WITHIN_API();
15281510
}
15291511

1512+
15301513
#endif /* INCLUDE_vTaskDelay */
15311514
/*-----------------------------------------------------------*/
15321515

0 commit comments

Comments
 (0)