diff --git a/hypervisor/common/hv_main.c b/hypervisor/common/hv_main.c index 2028b5030..4bd06229b 100644 --- a/hypervisor/common/hv_main.c +++ b/hypervisor/common/hv_main.c @@ -56,7 +56,7 @@ void vcpu_thread(struct vcpu *vcpu) } vmexit_end = rdtsc(); - if (vmexit_begin > 0) + if (vmexit_begin != 0UL) per_cpu(vmexit_time, vcpu->pcpu_id)[basic_exit_reason] += (vmexit_end - vmexit_begin); TRACE_2L(TRACE_VM_ENTER, 0, 0); @@ -156,17 +156,17 @@ void get_vmexit_profile(char *str, int str_max) size -= len; str += len; - for (cpu = 0; cpu < phys_cpu_num; cpu++) { + for (cpu = 0U; cpu < phys_cpu_num; cpu++) { len = snprintf(str, size, "\t CPU%hu\t US", cpu); size -= len; str += len; } - for (i = 0; i < 64; i++) { + for (i = 0U; i < 64U; i++) { len = snprintf(str, size, "\r\n0x%x", i); size -= len; str += len; - for (cpu = 0; cpu < phys_cpu_num; cpu++) { + for (cpu = 0U; cpu < phys_cpu_num; cpu++) { len = snprintf(str, size, "\t%10lld\t%10lld", per_cpu(vmexit_cnt, cpu)[i], ticks_to_us(per_cpu(vmexit_time, cpu)[i])); diff --git a/hypervisor/common/schedule.c b/hypervisor/common/schedule.c index 27ec702e3..59e46223f 100644 --- a/hypervisor/common/schedule.c +++ b/hypervisor/common/schedule.c @@ -13,11 +13,11 @@ void init_scheduler(void) { uint32_t i; - for (i = 0; i < phys_cpu_num; i++) { + for (i = 0U; i < phys_cpu_num; i++) { spinlock_init(&per_cpu(sched_ctx, i).runqueue_lock); spinlock_init(&per_cpu(sched_ctx, i).scheduler_lock); INIT_LIST_HEAD(&per_cpu(sched_ctx, i).runqueue); - per_cpu(sched_ctx, i).flags= 0; + per_cpu(sched_ctx, i).flags = 0UL; per_cpu(sched_ctx, i).curr_vcpu = NULL; } } @@ -36,7 +36,7 @@ uint16_t allocate_pcpu(void) { uint16_t i; - for (i = 0; i < phys_cpu_num; i++) { + for (i = 0U; i < phys_cpu_num; i++) { if (bitmap_test_and_set(i, &pcpu_used_bitmap) == 0) return i; } diff --git a/hypervisor/common/vm_load.c b/hypervisor/common/vm_load.c index 46e6fd7ee..35d604de6 100644 --- a/hypervisor/common/vm_load.c +++ b/hypervisor/common/vm_load.c @@ -11,10 +11,10 @@ static uint32_t create_e820_table(struct e820_entry *_e820) { uint32_t i; - ASSERT(e820_entries > 0, + ASSERT(e820_entries > 0U, "e820 should be inited"); - for (i = 0; i < e820_entries; i++) { + for (i = 0U; i < e820_entries; i++) { _e820[i].baseaddr = e820[i].baseaddr; _e820[i].length = e820[i].length; _e820[i].type = e820[i].type;