hv:remove need_cleanup flag in create_vm

remove this redundancy flag.

Tracked-On: #1842
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Mingqiang Chi 2019-12-11 15:34:40 +08:00 committed by wenlingz
parent 67ec1b7708
commit 7f96465407
1 changed files with 4 additions and 12 deletions

View File

@ -460,7 +460,6 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_
{
struct acrn_vm *vm = NULL;
int32_t status = 0;
bool need_cleanup = false;
uint32_t i;
uint16_t pcpu_id;
@ -483,9 +482,6 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_
prepare_sos_vm_memmap(vm);
status = init_vm_boot_info(vm);
if (status != 0) {
need_cleanup = true;
}
} else {
/* For PRE_LAUNCHED_VM and POST_LAUNCHED_VM */
if ((vm_config->guest_flags & GUEST_FLAG_SECURE_WORLD_ENABLED) != 0U) {
@ -560,14 +556,6 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_
status = set_vcpuid_entries(vm);
if (status == 0) {
vm->state = VM_CREATED;
} else {
need_cleanup = true;
}
}
if (need_cleanup) {
if (vm->arch_vm.nworld_eptp != NULL) {
(void)memset(vm->arch_vm.nworld_eptp, 0U, PAGE_SIZE);
}
}
@ -585,6 +573,10 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_
}
}
if ((status != 0) && (vm->arch_vm.nworld_eptp != NULL)) {
(void)memset(vm->arch_vm.nworld_eptp, 0U, PAGE_SIZE);
}
return status;
}