mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-10 12:32:45 +00:00
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. Tracked-On: #861 Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
This commit is contained in:
parent
952943c3ea
commit
d89ce8aeb4
@ -41,14 +41,16 @@ void release_schedule_lock(uint16_t pcpu_id)
|
|||||||
uint16_t allocate_pcpu(void)
|
uint16_t allocate_pcpu(void)
|
||||||
{
|
{
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
|
uint16_t ret = INVALID_CPU_ID;
|
||||||
|
|
||||||
for (i = 0U; i < phys_cpu_num; i++) {
|
for (i = 0U; i < phys_cpu_num; i++) {
|
||||||
if (bitmap_test_and_set_lock(i, &pcpu_used_bitmap) == 0) {
|
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)
|
void set_pcpu_used(uint16_t pcpu_id)
|
||||||
@ -183,8 +185,7 @@ void schedule(void)
|
|||||||
if (prev == next) {
|
if (prev == next) {
|
||||||
release_schedule_lock(pcpu_id);
|
release_schedule_lock(pcpu_id);
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
prepare_switch(prev, next);
|
prepare_switch(prev, next);
|
||||||
release_schedule_lock(pcpu_id);
|
release_schedule_lock(pcpu_id);
|
||||||
|
|
||||||
@ -196,6 +197,7 @@ void schedule(void)
|
|||||||
|
|
||||||
ASSERT(false, "Shouldn't go here");
|
ASSERT(false, "Shouldn't go here");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void switch_to_idle(run_thread_t idle_thread)
|
void switch_to_idle(run_thread_t idle_thread)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user