HV: treewide: fix violations of coding guideline C-EP-05

The coding guideline rule C-EP-05 requires that 'parentheses shall be used
to set the operator precedence explicitly'. This patch adds the missing
parentheses detected by the static analyzer.

Tracked-On: #6776
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Junjie Mao
2021-10-29 10:10:56 +08:00
committed by wenlingz
parent 4cf6c288cd
commit 3f3f4be642
6 changed files with 12 additions and 12 deletions

View File

@@ -292,7 +292,7 @@ void create_prelaunched_vm_e820(struct acrn_vm *vm)
hpa1_hi_size = vm_config->memory.size - lowmem_max_length;
gpa_start = add_ram_entry((vm->e820_entries + entry_idx), gpa_start, hpa1_hi_size);
entry_idx++;
} else if (vm_config->memory.size <= MEM_1M + hpa1_part1_max_length + MEM_1M) {
} else if (vm_config->memory.size <= (MEM_1M + hpa1_part1_max_length + MEM_1M)) {
/*
* In this case, hpa1 is only enough for the first
* 1M + part1 + last 1M (ACPI NVS/DATA), so part2 will be empty.
@@ -310,7 +310,7 @@ void create_prelaunched_vm_e820(struct acrn_vm *vm)
hpa2_lo_size = (lowmem_max_length - vm_config->memory.size);
gpa_start = vm->e820_entries[ENTRY_HPA1_LOW_PART2].baseaddr + vm->e820_entries[ENTRY_HPA1_LOW_PART2].length;
if (hpa2_lo_size > 0 && remaining_hpa2_size > 0) {
if ((hpa2_lo_size > 0) && (remaining_hpa2_size > 0)) {
/* In this case, hpa2 may have some parts to be mapped to lowmem, so we add an entry for hpa2_lo */
if (remaining_hpa2_size > hpa2_lo_size) {
remaining_hpa2_size -= hpa2_lo_size;

View File

@@ -108,7 +108,7 @@ static void free_irq_vector(uint32_t irq)
vr = irqd->vector;
irqd->vector = VECTOR_INVALID;
if (vr <= NR_MAX_VECTOR && vector_to_irq[vr] == irq) {
if ((vr <= NR_MAX_VECTOR) && (vector_to_irq[vr] == irq)) {
vector_to_irq[vr] = IRQ_INVALID;
}
}

View File

@@ -16,7 +16,7 @@ struct page *alloc_page(struct page_pool *pool)
spinlock_obtain(&pool->lock);
for (loop_idx = pool->last_hint_id;
loop_idx < pool->last_hint_id + pool->bitmap_size; loop_idx++) {
loop_idx < (pool->last_hint_id + pool->bitmap_size); loop_idx++) {
idx = loop_idx % pool->bitmap_size;
if (*(pool->bitmap + idx) != ~0UL) {
bit = ffz64(*(pool->bitmap + idx));