mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-18 08:11:07 +00:00
hv: memory: fix "Procedure has more than one exit point"
IEC 61508,ISO 26262 standards highly recommend single-exit rule. Reduce the count of the "return entries". Fix the violations which is comply with the cases list below: 1.Function has 2 return entries. 2.The first return entry is used to return the error code of checking variable whether is valid. Fix the violations in "if else" format. Tracked-On: #861 Signed-off-by: Huihuang Shi <huihuang.shi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
ddb548367a
commit
279808b202
@ -156,11 +156,9 @@ uint16_t allocate_vpid(void)
|
|||||||
|
|
||||||
void flush_vpid_single(uint16_t vpid)
|
void flush_vpid_single(uint16_t vpid)
|
||||||
{
|
{
|
||||||
if (vpid == 0U) {
|
if (vpid != 0U) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
local_invvpid(VMX_VPID_TYPE_SINGLE_CONTEXT, vpid, 0UL);
|
local_invvpid(VMX_VPID_TYPE_SINGLE_CONTEXT, vpid, 0UL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void flush_vpid_global(void)
|
void flush_vpid_global(void)
|
||||||
|
@ -165,9 +165,7 @@ static void update_ept_mem_type(const struct acrn_vcpu *vcpu)
|
|||||||
*/
|
*/
|
||||||
if (!is_mtrr_enabled(vcpu) || !is_fixed_range_mtrr_enabled(vcpu)) {
|
if (!is_mtrr_enabled(vcpu) || !is_fixed_range_mtrr_enabled(vcpu)) {
|
||||||
update_ept(vcpu->vm, 0U, MAX_FIXED_RANGE_ADDR, get_default_memory_type(vcpu));
|
update_ept(vcpu->vm, 0U, MAX_FIXED_RANGE_ADDR, get_default_memory_type(vcpu));
|
||||||
return;
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
/* Deal with fixed-range MTRRs only */
|
/* Deal with fixed-range MTRRs only */
|
||||||
for (i = 0U; i < FIXED_RANGE_MTRR_NUM; i++) {
|
for (i = 0U; i < FIXED_RANGE_MTRR_NUM; i++) {
|
||||||
type = vcpu->mtrr.fixed_range[i].type[0];
|
type = vcpu->mtrr.fixed_range[i].type[0];
|
||||||
@ -188,6 +186,7 @@ static void update_ept_mem_type(const struct acrn_vcpu *vcpu)
|
|||||||
|
|
||||||
update_ept(vcpu->vm, start, size, type);
|
update_ept(vcpu->vm, start, size, type);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mtrr_wrmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t value)
|
void mtrr_wrmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t value)
|
||||||
|
Loading…
Reference in New Issue
Block a user