diff --git a/queue.c b/queue.c index 3bc959721ed..ffb180ec803 100644 --- a/queue.c +++ b/queue.c @@ -389,8 +389,8 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue, /* A queue storage area should be provided if the item size is not 0, and * should not be provided if the item size is 0. */ - ( !( ( pucQueueStorage != NULL ) && ( uxItemSize == 0 ) ) ) && - ( !( ( pucQueueStorage == NULL ) && ( uxItemSize != 0 ) ) ) ) + ( !( ( pucQueueStorage != NULL ) && ( uxItemSize == 0U ) ) ) && + ( !( ( pucQueueStorage == NULL ) && ( uxItemSize != 0U ) ) ) ) { #if ( configASSERT_DEFINED == 1 ) { @@ -864,7 +864,7 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, traceENTER_xQueueCreateCountingSemaphoreStatic( uxMaxCount, uxInitialCount, pxStaticQueue ); - if( ( uxMaxCount != 0 ) && + if( ( uxMaxCount != 0U ) && ( uxInitialCount <= uxMaxCount ) ) { xHandle = xQueueGenericCreateStatic( uxMaxCount, queueSEMAPHORE_QUEUE_ITEM_LENGTH, NULL, pxStaticQueue, queueQUEUE_TYPE_COUNTING_SEMAPHORE ); @@ -903,7 +903,7 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, traceENTER_xQueueCreateCountingSemaphore( uxMaxCount, uxInitialCount ); - if( ( uxMaxCount != 0 ) && + if( ( uxMaxCount != 0U ) && ( uxInitialCount <= uxMaxCount ) ) { xHandle = xQueueGenericCreate( uxMaxCount, queueSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_COUNTING_SEMAPHORE ); diff --git a/stream_buffer.c b/stream_buffer.c index 32aa8e4f2b3..10123b916c0 100644 --- a/stream_buffer.c +++ b/stream_buffer.c @@ -362,7 +362,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer, * this is a quirk of the implementation that means otherwise the free * space would be reported as one byte smaller than would be logically * expected. */ - if( xBufferSizeBytes < ( xBufferSizeBytes + 1 + sizeof( StreamBuffer_t ) ) ) + if( xBufferSizeBytes < ( xBufferSizeBytes + 1U + sizeof( StreamBuffer_t ) ) ) { xBufferSizeBytes++; pvAllocatedMemory = pvPortMalloc( xBufferSizeBytes + sizeof( StreamBuffer_t ) ); diff --git a/tasks.c b/tasks.c index 50706ad44ac..c83912dd2ab 100644 --- a/tasks.c +++ b/tasks.c @@ -962,7 +962,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; #if ( configRUN_MULTIPLE_PRIORITIES == 0 ) /* Verify that the calling core always yields to higher priority tasks. */ - if( ( ( pxCurrentTCBs[ portGET_CORE_ID() ]->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) == 0 ) && + if( ( ( pxCurrentTCBs[ portGET_CORE_ID() ]->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) == 0U ) && ( pxTCB->uxPriority > pxCurrentTCBs[ portGET_CORE_ID() ]->uxPriority ) ) { configASSERT( ( xYieldPendings[ portGET_CORE_ID() ] == pdTRUE ) || @@ -1044,7 +1044,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; * idle tasks, not user tasks at the idle priority. */ if( uxCurrentPriority < uxTopReadyPriority ) { - if( ( pxTCB->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) == 0 ) + if( ( pxTCB->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) == 0U ) { continue; } @@ -1136,7 +1136,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION; for( x = ( BaseType_t ) 0; x < ( BaseType_t ) configNUMBER_OF_CORES; x++ ) { - if( ( pxCurrentTCBs[ x ]->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) != 0 ) + if( ( pxCurrentTCBs[ x ]->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) != 0U ) { prvYieldCore( x ); } @@ -1854,7 +1854,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, /* Ensure the name string is terminated in the case that the string length * was greater or equal to configMAX_TASK_NAME_LEN. */ - pxNewTCB->pcTaskName[ configMAX_TASK_NAME_LEN - 1 ] = '\0'; + pxNewTCB->pcTaskName[ configMAX_TASK_NAME_LEN - 1U ] = '\0'; } else { @@ -2165,7 +2165,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, * large to hold the generated string. Return the * number of characters actually written without * counting the terminating NULL character. */ - uxCharsWritten = n - 1; + uxCharsWritten = n - 1U; } else { @@ -3873,7 +3873,7 @@ void vTaskSuspendAll( void ) { xReturn = 0; } - else if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > 1 ) + else if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ tskIDLE_PRIORITY ] ) ) > 1U ) { /* There are other idle priority tasks in the ready state. If * time slicing is used then the very next tick interrupt must be @@ -4813,7 +4813,7 @@ BaseType_t xTaskIncrementTick( void ) { #if ( configNUMBER_OF_CORES == 1 ) { - if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB->uxPriority ] ) ) > ( UBaseType_t ) 1 ) + if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB->uxPriority ] ) ) > 1U ) { xSwitchRequired = pdTRUE; } @@ -4828,7 +4828,7 @@ BaseType_t xTaskIncrementTick( void ) for( xCoreID = 0; xCoreID < ( ( BaseType_t ) configNUMBER_OF_CORES ); xCoreID++ ) { - if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCBs[ xCoreID ]->uxPriority ] ) ) > 1 ) + if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCBs[ xCoreID ]->uxPriority ] ) ) > 1U ) { xYieldRequiredForCore[ xCoreID ] = pdTRUE; } @@ -5807,7 +5807,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) * valid. */ xExpectedIdleTime = prvGetExpectedIdleTime(); - if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP ) + if( xExpectedIdleTime >= ( TickType_t ) configEXPECTED_IDLE_TIME_BEFORE_SLEEP ) { vTaskSuspendAll(); { @@ -5822,7 +5822,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) * portSUPPRESS_TICKS_AND_SLEEP() to be called. */ configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( xExpectedIdleTime ); - if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP ) + if( xExpectedIdleTime >= ( TickType_t ) configEXPECTED_IDLE_TIME_BEFORE_SLEEP ) { traceLOW_POWER_IDLE_BEGIN(); portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ); @@ -5874,7 +5874,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) /* This function must be called from a critical section. */ - if( listCURRENT_LIST_LENGTH( &xPendingReadyList ) != 0 ) + if( listCURRENT_LIST_LENGTH( &xPendingReadyList ) != 0U ) { /* A task was made ready while the scheduler was suspended. */ eReturn = eAbortSleep; @@ -5884,7 +5884,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) /* A yield was pended while the scheduler was suspended. */ eReturn = eAbortSleep; } - else if( xPendedTicks != 0 ) + else if( xPendedTicks != 0U ) { /* A tick interrupt has already occurred but was held pending * because the scheduler is suspended. */ @@ -6898,7 +6898,7 @@ static void prvResetNextTaskUnblockTime( void ) * interrupt. Only assert if the critical nesting count is 1 to * protect against recursive calls if the assert function also uses a * critical section. */ - if( pxCurrentTCB->uxCriticalNesting == 1 ) + if( pxCurrentTCB->uxCriticalNesting == 1U ) { portASSERT_IF_IN_ISR(); } @@ -7269,13 +7269,13 @@ static void prvResetNextTaskUnblockTime( void ) * can be printed in tabular form more easily. */ pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName ); /* Do not count the terminating null character. */ - uxConsumedBufferLength = uxConsumedBufferLength + ( configMAX_TASK_NAME_LEN - 1 ); + uxConsumedBufferLength = uxConsumedBufferLength + ( configMAX_TASK_NAME_LEN - 1U ); /* Is there space left in the buffer? -1 is done because snprintf * writes a terminating null character. So we are essentially * checking if the buffer has space to write at least one non-null * character. */ - if( uxConsumedBufferLength < ( uxBufferLength - 1 ) ) + if( uxConsumedBufferLength < ( uxBufferLength - 1U ) ) { /* Write the rest of the string. */ #if ( ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) @@ -7411,13 +7411,13 @@ static void prvResetNextTaskUnblockTime( void ) * easily. */ pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName ); /* Do not count the terminating null character. */ - uxConsumedBufferLength = uxConsumedBufferLength + ( configMAX_TASK_NAME_LEN - 1 ); + uxConsumedBufferLength = uxConsumedBufferLength + ( configMAX_TASK_NAME_LEN - 1U ); /* Is there space left in the buffer? -1 is done because snprintf * writes a terminating null character. So we are essentially * checking if the buffer has space to write at least one non-null * character. */ - if( uxConsumedBufferLength < ( uxBufferLength - 1 ) ) + if( uxConsumedBufferLength < ( uxBufferLength - 1U ) ) { if( ulStatsAsPercentage > 0UL ) { diff --git a/timers.c b/timers.c index 2f575627ada..878e7db1198 100644 --- a/timers.c +++ b/timers.c @@ -603,7 +603,7 @@ configASSERT( xTimer ); taskENTER_CRITICAL(); { - if( ( pxTimer->ucStatus & tmrSTATUS_IS_AUTORELOAD ) == 0 ) + if( ( pxTimer->ucStatus & tmrSTATUS_IS_AUTORELOAD ) == 0U ) { /* Not an auto-reload timer. */ xReturn = pdFALSE; @@ -662,7 +662,7 @@ configASSERT( ppxTimerBuffer != NULL ); - if( ( pxTimer->ucStatus & tmrSTATUS_IS_STATICALLY_ALLOCATED ) != 0 ) + if( ( pxTimer->ucStatus & tmrSTATUS_IS_STATICALLY_ALLOCATED ) != 0U ) { *ppxTimerBuffer = ( StaticTimer_t * ) pxTimer; xReturn = pdTRUE; @@ -724,7 +724,7 @@ /* If the timer is an auto-reload timer then calculate the next * expiry time and re-insert the timer in the list of active timers. */ - if( ( pxTimer->ucStatus & tmrSTATUS_IS_AUTORELOAD ) != 0 ) + if( ( pxTimer->ucStatus & tmrSTATUS_IS_AUTORELOAD ) != 0U ) { prvReloadTimer( pxTimer, xNextExpireTime, xTimeNow ); } @@ -1001,7 +1001,7 @@ { /* The timer expired before it was added to the active * timer list. Process it now. */ - if( ( pxTimer->ucStatus & tmrSTATUS_IS_AUTORELOAD ) != 0 ) + if( ( pxTimer->ucStatus & tmrSTATUS_IS_AUTORELOAD ) != 0U ) { prvReloadTimer( pxTimer, xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, xTimeNow ); } @@ -1165,7 +1165,7 @@ /* Is the timer in the list of active timers? */ taskENTER_CRITICAL(); { - if( ( pxTimer->ucStatus & tmrSTATUS_IS_ACTIVE ) == 0 ) + if( ( pxTimer->ucStatus & tmrSTATUS_IS_ACTIVE ) == 0U ) { xReturn = pdFALSE; }