Fix compiler warnings for schedulerstrongapa.c

This commit is contained in:
Richi Dubey
2021-07-05 21:45:27 +05:30
committed by Sebastian Huber
parent 0d3453a47e
commit b5f850495d

View File

@@ -187,7 +187,7 @@ static inline Scheduler_Node * _Scheduler_strong_APA_Find_highest_ready(
uint32_t rear uint32_t rear
) )
{ {
Scheduler_Node *highest_ready; Scheduler_Node *highest_ready = NULL;
Scheduler_strong_APA_CPU *CPU; Scheduler_strong_APA_CPU *CPU;
const Chain_Node *tail; const Chain_Node *tail;
Chain_Node *next; 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; return highest_ready;
} }
@@ -494,7 +500,7 @@ static inline Scheduler_Node* _Scheduler_strong_APA_Get_lowest_reachable(
Per_CPU_Control **cpu_to_preempt Per_CPU_Control **cpu_to_preempt
) )
{ {
Scheduler_Node *lowest_reachable; Scheduler_Node *lowest_reachable = NULL;
Priority_Control max_priority_num; Priority_Control max_priority_num;
uint32_t cpu_max; uint32_t cpu_max;
uint32_t cpu_index; 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; return lowest_reachable;
} }
@@ -673,7 +684,7 @@ static inline bool _Scheduler_strong_APA_Enqueue(
Scheduler_strong_APA_CPU *CPU; Scheduler_strong_APA_CPU *CPU;
uint32_t cpu_max; uint32_t cpu_max;
uint32_t cpu_index; uint32_t cpu_index;
Per_CPU_Control *cpu_to_preempt; Per_CPU_Control *cpu_to_preempt = NULL;
Scheduler_Node *lowest_reachable; Scheduler_Node *lowest_reachable;
Scheduler_strong_APA_Node *strong_node; Scheduler_strong_APA_Node *strong_node;
@@ -711,7 +722,12 @@ static inline bool _Scheduler_strong_APA_Enqueue(
rear, rear,
&cpu_to_preempt &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( return _Scheduler_strong_APA_Do_enqueue(
context, context,
lowest_reachable, lowest_reachable,