score: Help static analysis in thread init

Add an assert to _Thread_Initialize_scheduler_and_wait_nodes() which may
help a static analyzer.  Use a do/while loop since we have at least one
scheduler.

Update #4832.
This commit is contained in:
Sebastian Huber
2023-01-28 10:56:38 +01:00
parent 6fa3a3b32a
commit 453939753b

View File

@@ -139,7 +139,10 @@ static void _Thread_Initialize_scheduler_and_wait_nodes(
* The application configuration ensures that we have at least one scheduler * The application configuration ensures that we have at least one scheduler
* configured. * configured.
*/ */
while ( scheduler_index < _Scheduler_Count ) {
_Assert ( _Scheduler_Count >= 1 );
do {
Priority_Control priority; Priority_Control priority;
if ( scheduler == config->scheduler ) { if ( scheduler == config->scheduler ) {
@@ -172,7 +175,7 @@ static void _Thread_Initialize_scheduler_and_wait_nodes(
( (uintptr_t) scheduler_node + _Scheduler_Node_size ); ( (uintptr_t) scheduler_node + _Scheduler_Node_size );
++scheduler; ++scheduler;
++scheduler_index; ++scheduler_index;
} } while ( scheduler_index < _Scheduler_Count );
/* /*
* The thread is initialized to use exactly one scheduler node which is * The thread is initialized to use exactly one scheduler node which is