Skip to content

Commit fced4a9

Browse files
committed
Declare variable initially
1 parent a64c2ed commit fced4a9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tasks.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
985985
UBaseType_t uxCurrentPriority = uxTopReadyPriority;
986986
BaseType_t xTaskScheduled = pdFALSE;
987987
BaseType_t xDecrementTopPriority = pdTRUE;
988+
TCB_t * pxTCB = NULL;
988989

989990
#if ( configUSE_CORE_AFFINITY == 1 )
990991
const TCB_t * pxPreviousTCB = NULL;
@@ -1043,7 +1044,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
10431044
/* MISRA Ref 11.5.3 [Void pointer assignment] */
10441045
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
10451046
/* coverity[misra_c_2012_rule_11_5_violation] */
1046-
TCB_t * pxTCB = ( TCB_t * ) listGET_LIST_ITEM_OWNER( pxIterator );
1047+
pxTCB = ( TCB_t * ) listGET_LIST_ITEM_OWNER( pxIterator );
10471048

10481049
#if ( configRUN_MULTIPLE_PRIORITIES == 0 )
10491050
{
@@ -4181,6 +4182,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery )
41814182
const char pcNameToQuery[] )
41824183
{
41834184
TCB_t * pxReturn = NULL;
4185+
TCB_t * pxTCB = NULL;
41844186
UBaseType_t x;
41854187
char cNextChar;
41864188
BaseType_t xBreakLoop;
@@ -4196,7 +4198,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery )
41964198
/* MISRA Ref 11.5.3 [Void pointer assignment] */
41974199
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
41984200
/* coverity[misra_c_2012_rule_11_5_violation] */
4199-
TCB_t * pxTCB = listGET_LIST_ITEM_OWNER( pxIterator );
4201+
pxTCB = listGET_LIST_ITEM_OWNER( pxIterator );
42004202

42014203
/* Check each character in the name looking for a match or
42024204
* mismatch. */
@@ -6258,6 +6260,7 @@ static void prvCheckTasksWaitingTermination( void )
62586260
UBaseType_t uxTask = 0;
62596261
const ListItem_t * pxEndMarker = listGET_END_MARKER( pxList );
62606262
ListItem_t * pxIterator;
6263+
TCB_t * pxTCB = NULL;
62616264

62626265
if( listCURRENT_LIST_LENGTH( pxList ) > ( UBaseType_t ) 0 )
62636266
{
@@ -6270,7 +6273,7 @@ static void prvCheckTasksWaitingTermination( void )
62706273
/* MISRA Ref 11.5.3 [Void pointer assignment] */
62716274
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-115 */
62726275
/* coverity[misra_c_2012_rule_11_5_violation] */
6273-
TCB_t * pxTCB = listGET_LIST_ITEM_OWNER( pxIterator );
6276+
pxTCB = listGET_LIST_ITEM_OWNER( pxIterator );
62746277

62756278
vTaskGetInfo( ( TaskHandle_t ) pxTCB, &( pxTaskStatusArray[ uxTask ] ), pdTRUE, eState );
62766279
uxTask++;

0 commit comments

Comments
 (0)