hv:fix violations of coding guideline C-ST-04

The coding guideline rule C-ST-04 requires that
a 'if' statement followed by one or more 'else if'
statement shall be terminated by an 'else' statement
which contains either appropriate action or a comment.

Tracked-On: #6776
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Mingqiang Chi
2022-01-26 16:35:45 +08:00
committed by acrnsi-robot
parent b7a99f4530
commit 3d5c3c4754
10 changed files with 50 additions and 23 deletions

View File

@@ -212,6 +212,8 @@ static bool pm1ab_io_write(struct acrn_vcpu *vcpu, uint16_t addr, size_t width,
enter_s3(vm, v, 0U);
} else if (vm->pm.sx_state_data->s5_pkg.val_pm1a == val) {
enter_s5(vcpu, v, 0U);
} else {
/* other Sx value should be ignored */
}
}
@@ -226,6 +228,8 @@ static bool pm1ab_io_write(struct acrn_vcpu *vcpu, uint16_t addr, size_t width,
enter_s3(vm, pm1a_cnt_val, v);
} else if (vm->pm.sx_state_data->s5_pkg.val_pm1b == val) {
enter_s5(vcpu, pm1a_cnt_val, v);
} else {
/* other Sx value should be ignored */
}
} else {
/* the case broke ACPI spec */
@@ -396,10 +400,12 @@ void init_guest_pm(struct acrn_vm *vm)
if (vm_load_pm_s_state(vm) == 0) {
register_pm1ab_handler(vm);
}
} else if (is_postlaunched_vm(vm) && is_rt_vm(vm)) {
/* Intercept the virtual pm port for post launched RTVM */
register_rt_vm_pm1a_ctl_handler(vm);
} else if (is_prelaunched_vm(vm)) {
} else if (is_postlaunched_vm(vm)) {
if (is_rt_vm(vm)) {
/* Intercept the virtual pm port for post launched RTVM */
register_rt_vm_pm1a_ctl_handler(vm);
}
} else { /* prelaunched vm */
/* Intercept the virtual sleep control/status registers for pre-launched VM */
register_prelaunched_vm_sleep_handler(vm);
}

View File

@@ -333,8 +333,10 @@ static void prepare_prelaunched_vm_memmap(struct acrn_vm *vm, const struct acrn_
base_hpa += entry->length;
remaining_hpa_size -= entry->length;
}
} else if (entry->type == E820_TYPE_RAM) {
pr_warn("%s: HPA size incorrectly configured in v820\n", __func__);
} else {
if (entry->type == E820_TYPE_RAM) {
pr_warn("%s: HPA size incorrectly configured in v820\n", __func__);
}
}
if ((remaining_hpa_size == 0UL) && (is_hpa1)) {

View File

@@ -1072,8 +1072,10 @@ static int32_t iommu_attach_device(const struct iommu_domain *domain, uint8_t bu
iommu_flush_cache(context_entry, sizeof(struct dmar_entry));
ret = 0;
}
} else if (is_dmar_unit_ignored(dmar_unit)) {
ret = 0;
} else {
if (is_dmar_unit_ignored(dmar_unit)) {
ret = 0;
}
}
return ret;
@@ -1127,8 +1129,10 @@ static int32_t iommu_detach_device(const struct iommu_domain *domain, uint8_t bu
dmar_invalid_iotlb(dmar_unit, vmid_to_domainid(domain->vm_id), 0UL, 0U, false,
DMAR_IIRG_DOMAIN);
}
} else if (is_dmar_unit_ignored(dmar_unit)) {
ret = 0;
} else {
if (is_dmar_unit_ignored(dmar_unit)) {
ret = 0;
}
}
return ret;