mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-25 15:02:13 +00:00
HV: remove few return statement in while loop of copy_gva function
The coding style of multiple returns/exit in while loop is not MISRA compatible. Remove the returns in while loop. Tracked-On: #861 Signed-off-by: Chaohong guo <chaohong.guo@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
5a583fb87c
commit
b4b9ac593a
@ -391,33 +391,29 @@ static inline int32_t copy_gva(struct acrn_vcpu *vcpu, void *h_ptr_arg, uint64_t
|
||||
{
|
||||
void *h_ptr = h_ptr_arg;
|
||||
uint64_t gpa = 0UL;
|
||||
int32_t ret;
|
||||
int32_t ret = 0;
|
||||
uint32_t len;
|
||||
uint64_t gva = gva_arg;
|
||||
uint32_t size = size_arg;
|
||||
|
||||
while (size > 0U) {
|
||||
while ((size > 0U) && (ret == 0)) {
|
||||
ret = gva2gpa(vcpu, gva, &gpa, err_code);
|
||||
if (ret < 0) {
|
||||
*fault_addr = gva;
|
||||
pr_err("error[%d] in GVA2GPA, err_code=0x%x",
|
||||
ret, *err_code);
|
||||
return ret;
|
||||
}
|
||||
|
||||
len = local_copy_gpa(vcpu->vm, h_ptr, gpa, size,
|
||||
PAGE_SIZE_4K, cp_from_vm);
|
||||
|
||||
if (len == 0U) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (ret >= 0) {
|
||||
len = local_copy_gpa(vcpu->vm, h_ptr, gpa, size, PAGE_SIZE_4K, cp_from_vm);
|
||||
if (len != 0U) {
|
||||
gva += len;
|
||||
h_ptr += len;
|
||||
size -= len;
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
}
|
||||
} else {
|
||||
*fault_addr = gva;
|
||||
pr_err("error[%d] in GVA2GPA, err_code=0x%x", ret, *err_code);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* @pre Caller(Guest) should make sure gpa is continuous.
|
||||
|
Loading…
Reference in New Issue
Block a user