diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-01-28 10:56:38 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-01-28 17:58:20 +0100 |
commit | 453939753b7fd758b49631c6a8cba10d8fdddaf7 (patch) | |
tree | 9e006dac7f37bb966d54114ac123491337cd28e5 /cpukit/score/src/threadinitialize.c | |
parent | spec: Fix XPS_SYS_CTRL_BASEADDR default value (diff) | |
download | rtems-453939753b7fd758b49631c6a8cba10d8fdddaf7.tar.bz2 |
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.
Diffstat (limited to 'cpukit/score/src/threadinitialize.c')
-rw-r--r-- | cpukit/score/src/threadinitialize.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c index 31698524a9..e1a6c7de93 100644 --- a/cpukit/score/src/threadinitialize.c +++ b/cpukit/score/src/threadinitialize.c @@ -139,7 +139,10 @@ static void _Thread_Initialize_scheduler_and_wait_nodes( * The application configuration ensures that we have at least one scheduler * configured. */ - while ( scheduler_index < _Scheduler_Count ) { + + _Assert ( _Scheduler_Count >= 1 ); + + do { Priority_Control priority; if ( scheduler == config->scheduler ) { @@ -172,7 +175,7 @@ static void _Thread_Initialize_scheduler_and_wait_nodes( ( (uintptr_t) scheduler_node + _Scheduler_Node_size ); ++scheduler; ++scheduler_index; - } + } while ( scheduler_index < _Scheduler_Count ); /* * The thread is initialized to use exactly one scheduler node which is |