HV:common:fix "signed/unsigned conversion without cast"

Misra C required signed/unsigned conversion with cast.

V1->V2:
  a.split patch to patch series

V2->V3:
  a.change the uint64_t type numeric constant's suffix from U to UL

Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Huihuang Shi 2018-07-03 18:37:07 +08:00 committed by lijinxia
parent 91fdffb19a
commit 102d2f1a68
3 changed files with 9 additions and 9 deletions

View File

@ -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]));

View File

@ -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;
}

View File

@ -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;