mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-08 20:29:40 +00:00
hv:fixed several return value violations
-- change two timer callbacks to void type -- ignore the return value for add_timer -- add (void) before several functions(memset/memcpy/ vcpu_get_xxx) v1-->v2: ignore the return value for add_timer Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
@@ -96,7 +96,7 @@ apicv_batch_set_tmr(struct acrn_vlapic *vlapic);
|
||||
*/
|
||||
static void vlapic_set_error(struct acrn_vlapic *vlapic, uint32_t mask);
|
||||
|
||||
static int vlapic_timer_expired(void *data);
|
||||
static void vlapic_timer_expired(void *data);
|
||||
|
||||
static struct acrn_vlapic *
|
||||
vm_lapic_from_vcpu_id(struct vm *vm, uint16_t vcpu_id)
|
||||
@@ -394,7 +394,11 @@ static void vlapic_icrtmr_write_handler(struct acrn_vlapic *vlapic)
|
||||
|
||||
del_timer(&vtimer->timer);
|
||||
if (set_expiration(vlapic)) {
|
||||
add_timer(&vtimer->timer);
|
||||
/* vlapic_create_timer has been called,
|
||||
* and timer->fire_tsc is not 0, here
|
||||
* add_timer should not return error
|
||||
*/
|
||||
(void)add_timer(&vtimer->timer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,8 +432,11 @@ static void vlapic_set_tsc_deadline_msr(struct acrn_vlapic *vlapic,
|
||||
/* transfer guest tsc to host tsc */
|
||||
val -= exec_vmread64(VMX_TSC_OFFSET_FULL);
|
||||
timer->fire_tsc = val;
|
||||
|
||||
add_timer(timer);
|
||||
/* vlapic_create_timer has been called,
|
||||
* and timer->fire_tsc is not 0,here
|
||||
* add_timer should not return error
|
||||
*/
|
||||
(void)add_timer(timer);
|
||||
} else {
|
||||
timer->fire_tsc = 0UL;
|
||||
}
|
||||
@@ -1311,7 +1318,11 @@ vlapic_svr_write_handler(struct acrn_vlapic *vlapic)
|
||||
dev_dbg(ACRN_DBG_LAPIC, "vlapic is software-enabled");
|
||||
if (vlapic_lvtt_period(vlapic)) {
|
||||
if (set_expiration(vlapic)) {
|
||||
add_timer(&vlapic->vtimer.timer);
|
||||
/* vlapic_create_timer has been called,
|
||||
* and timer->fire_tsc is not 0,here
|
||||
* add_timer should not return error
|
||||
*/
|
||||
(void)add_timer(&vlapic->vtimer.timer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1883,7 +1894,7 @@ vlapic_intr_msi(struct vm *vm, uint64_t addr, uint64_t msg)
|
||||
}
|
||||
|
||||
/* interrupt context */
|
||||
static int vlapic_timer_expired(void *data)
|
||||
static void vlapic_timer_expired(void *data)
|
||||
{
|
||||
struct vcpu *vcpu = (struct vcpu *)data;
|
||||
struct acrn_vlapic *vlapic;
|
||||
@@ -1900,8 +1911,6 @@ static int vlapic_timer_expired(void *data)
|
||||
if (!vlapic_lvtt_period(vlapic)) {
|
||||
vlapic->vtimer.timer.fire_tsc = 0UL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@@ -210,10 +210,10 @@ void destroy_secure_world(struct vm *vm, bool need_clr_mem)
|
||||
static void save_world_ctx(struct vcpu *vcpu, struct ext_context *ext_ctx)
|
||||
{
|
||||
/* cache on-demand run_context for efer/rflags/rsp/rip */
|
||||
vcpu_get_efer(vcpu);
|
||||
vcpu_get_rflags(vcpu);
|
||||
vcpu_get_rsp(vcpu);
|
||||
vcpu_get_rip(vcpu);
|
||||
(void)vcpu_get_efer(vcpu);
|
||||
(void)vcpu_get_rflags(vcpu);
|
||||
(void)vcpu_get_rsp(vcpu);
|
||||
(void)vcpu_get_rip(vcpu);
|
||||
|
||||
/* VMCS GUEST field */
|
||||
ext_ctx->vmx_cr0 = exec_vmread(VMX_GUEST_CR0);
|
||||
@@ -426,7 +426,7 @@ bool initialize_trusty(struct vcpu *vcpu, uint64_t param)
|
||||
struct vm *vm = vcpu->vm;
|
||||
struct trusty_boot_param boot_param;
|
||||
|
||||
memset(&boot_param, 0U, sizeof(boot_param));
|
||||
(void)memset(&boot_param, 0U, sizeof(boot_param));
|
||||
if (copy_from_gpa(vcpu->vm, &boot_param, param, sizeof(boot_param))) {
|
||||
pr_err("%s: Unable to copy trusty_boot_param\n", __func__);
|
||||
return false;
|
||||
@@ -497,7 +497,7 @@ void trusty_set_dseed(void *dseed, uint8_t dseed_num)
|
||||
|
||||
void save_sworld_context(struct vcpu *vcpu)
|
||||
{
|
||||
memcpy_s(&vcpu->vm->sworld_snapshot,
|
||||
(void)memcpy_s(&vcpu->vm->sworld_snapshot,
|
||||
sizeof(struct cpu_context),
|
||||
&vcpu->arch_vcpu.contexts[SECURE_WORLD],
|
||||
sizeof(struct cpu_context));
|
||||
@@ -513,7 +513,7 @@ void restore_sworld_context(struct vcpu *vcpu)
|
||||
sworld_ctl->sworld_memory.length,
|
||||
TRUSTY_EPT_REBASE_GPA);
|
||||
|
||||
memcpy_s(&vcpu->arch_vcpu.contexts[SECURE_WORLD],
|
||||
(void)memcpy_s(&vcpu->arch_vcpu.contexts[SECURE_WORLD],
|
||||
sizeof(struct cpu_context),
|
||||
&vcpu->vm->sworld_snapshot,
|
||||
sizeof(struct cpu_context));
|
||||
|
Reference in New Issue
Block a user