HV: Assignment should not mix with operator

Removed the postfix and prefix operation in assignment expression.
Noncompliant code example:
1) *a++ = *b ++;
2) a = arr[--b];

Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
This commit is contained in:
Yang, Yu-chu
2018-07-09 16:16:29 -07:00
committed by lijinxia
parent 7ed292eeef
commit 39159ebe16
7 changed files with 43 additions and 20 deletions

View File

@@ -255,8 +255,10 @@ uint16_t __attribute__((weak)) parse_madt(uint8_t *lapic_id_base)
static const uint8_t lapic_id[] = {0U, 2U, 4U, 6U};
uint32_t i;
for (i = 0U; i < ARRAY_SIZE(lapic_id); i++)
*lapic_id_base++ = lapic_id[i];
for (i = 0U; i < ARRAY_SIZE(lapic_id); i++) {
*lapic_id_base = lapic_id[i];
lapic_id_base++;
}
return ((uint16_t)ARRAY_SIZE(lapic_id));
}
@@ -279,8 +281,10 @@ static void init_phy_cpu_storage(void)
pcpu_num = parse_madt(lapic_id_base);
alloc_phy_cpu_data(pcpu_num);
for (i = 0U; i < pcpu_num; i++)
per_cpu(lapic_id, i) = *lapic_id_base++;
for (i = 0U; i < pcpu_num; i++) {
per_cpu(lapic_id, i) = *lapic_id_base;
lapic_id_base++;
}
/* free memory after lapic_id are saved in per_cpu data */
free((void *)lapic_id_base);

View File

@@ -68,7 +68,8 @@ static inline int set_vcpuid_entry(struct vm *vm,
return -ENOMEM;
}
tmp = &vm->vcpuid_entries[vm->vcpuid_entry_nr++];
tmp = &vm->vcpuid_entries[vm->vcpuid_entry_nr];
vm->vcpuid_entry_nr++;
(void)memcpy_s(tmp, entry_size, entry, entry_size);
return 0;
}