diff options
author | Richi Dubey <richidubey@gmail.com> | 2021-07-05 21:45:27 +0530 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-07-06 07:21:14 +0200 |
commit | b5f850495d91e9ad10ee05cc97c1194d1e6db1ee (patch) | |
tree | d034db7351c0c4031100bdb17e70cebf51b161b1 /cpukit/score/src | |
parent | bsps/imxrt: Simplify linkcmds and make it flexible (diff) | |
download | rtems-b5f850495d91e9ad10ee05cc97c1194d1e6db1ee.tar.bz2 |
Fix compiler warnings for schedulerstrongapa.c
Diffstat (limited to 'cpukit/score/src')
-rw-r--r-- | cpukit/score/src/schedulerstrongapa.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/cpukit/score/src/schedulerstrongapa.c b/cpukit/score/src/schedulerstrongapa.c index 845d19d1a8..2d138bc7c3 100644 --- a/cpukit/score/src/schedulerstrongapa.c +++ b/cpukit/score/src/schedulerstrongapa.c @@ -187,7 +187,7 @@ static inline Scheduler_Node * _Scheduler_strong_APA_Find_highest_ready( uint32_t rear ) { - Scheduler_Node *highest_ready; + Scheduler_Node *highest_ready = NULL; Scheduler_strong_APA_CPU *CPU; const Chain_Node *tail; Chain_Node *next; @@ -259,6 +259,12 @@ static inline Scheduler_Node * _Scheduler_strong_APA_Find_highest_ready( } } + /* + * By definition, the system would always have a ready node, + * hence highest_ready would not be NULL. + */ + _Assert( highest_ready != NULL ); + return highest_ready; } @@ -494,7 +500,7 @@ static inline Scheduler_Node* _Scheduler_strong_APA_Get_lowest_reachable( Per_CPU_Control **cpu_to_preempt ) { - Scheduler_Node *lowest_reachable; + Scheduler_Node *lowest_reachable = NULL; Priority_Control max_priority_num; uint32_t cpu_max; uint32_t cpu_index; @@ -546,6 +552,11 @@ static inline Scheduler_Node* _Scheduler_strong_APA_Get_lowest_reachable( } } } + /* + * Since it is not allowed for a task to have an empty affinity set, + * there would always be a lowest_reachable task, hence it would not be NULL + */ + _Assert( lowest_reachable != NULL ); return lowest_reachable; } @@ -673,7 +684,7 @@ static inline bool _Scheduler_strong_APA_Enqueue( Scheduler_strong_APA_CPU *CPU; uint32_t cpu_max; uint32_t cpu_index; - Per_CPU_Control *cpu_to_preempt; + Per_CPU_Control *cpu_to_preempt = NULL; Scheduler_Node *lowest_reachable; Scheduler_strong_APA_Node *strong_node; @@ -711,7 +722,12 @@ static inline bool _Scheduler_strong_APA_Enqueue( rear, &cpu_to_preempt ); - + /* + * Since it is not allowed for a task to have an empty affinity set, + * there would always be a lowest_reachable task, hence cpu_to_preempt + * would not be NULL. + */ + _Assert( cpu_to_preempt != NULL ); return _Scheduler_strong_APA_Do_enqueue( context, lowest_reachable, |