hv: schedule: fix "Procedure has more than one exit point"
Misra C requires Function must have only 1 return entry.
Fixed it by use "if ... else ..." format.
@@ -41,14 +41,16 @@ void release_schedule_lock(uint16_t pcpu_id)
uint16_t allocate_pcpu(void)
{
uint16_t i;
+ uint16_t ret = INVALID_CPU_ID;
for (i = 0U; i < phys_cpu_num; i++) {
if (bitmap_test_and_set_lock(i, &pcpu_used_bitmap) == 0) {
- return i;
+ ret = i;
+ break;
}
}
- return INVALID_CPU_ID;
+ return ret;
}
void set_pcpu_used(uint16_t pcpu_id)
@@ -183,8 +185,7 @@ void schedule(void)
if (prev == next) {
release_schedule_lock(pcpu_id);
return;
- }
-
+ } else {
prepare_switch(prev, next);
release_schedule_lock(pcpu_id);
@@ -196,6 +197,7 @@ void schedule(void)
ASSERT(false, "Shouldn't go here");
}
+}
void switch_to_idle(run_thread_t idle_thread)
{
