[PATCH] Fix compiler warnings for schedulerstrongapa.c

Richi Dubey richidubey at gmail.com
Sat Jul 3 07:06:09 UTC 2021


---
 cpukit/score/src/schedulerstrongapa.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/cpukit/score/src/schedulerstrongapa.c b/cpukit/score/src/schedulerstrongapa.c
index 845d19d1a8..b34ffe4b6d 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,10 @@ 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.
+   */
   return highest_ready;
 }
 
@@ -494,7 +498,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,7 +550,10 @@ 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
+   */
   return lowest_reachable;
 }
 
@@ -673,7 +680,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 +718,11 @@ 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.
+   */
   return _Scheduler_strong_APA_Do_enqueue(
            context,
            lowest_reachable,
-- 
2.17.1



More information about the devel mailing list