From 6be8283334686934efc78fc68d4726858d672e98 Mon Sep 17 00:00:00 2001 From: Huihuang Shi Date: Fri, 8 Jun 2018 15:44:19 +0800 Subject: [PATCH] fix MISRA C:"Statement with no side effect" V2->V3 modified the description V1->V2 add __unused to handler_private_data while misra c analyse callback function, it will dereference the pointer plus an implicit getting address when extra parentheses with inner star(example:(*foo)()). the first dereference should be removed. Signed-off-by: Huihuang Shi reviewed-by: Li,Fei1 reviewed-by: Junjie Mao Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/vioapic.c | 4 +--- hypervisor/arch/x86/guest/vlapic.c | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hypervisor/arch/x86/guest/vioapic.c b/hypervisor/arch/x86/guest/vioapic.c index a6fd975cd..d767d6532 100644 --- a/hypervisor/arch/x86/guest/vioapic.c +++ b/hypervisor/arch/x86/guest/vioapic.c @@ -565,14 +565,12 @@ vioapic_pincount(struct vm *vm) } int vioapic_mmio_access_handler(struct vcpu *vcpu, struct mem_io *mmio, - void *handler_private_data) + __unused void *handler_private_data) { struct vm *vm = vcpu->vm; uint64_t gpa = mmio->paddr; int ret = 0; - (void)handler_private_data; - /* Note all RW to IOAPIC are 32-Bit in size */ ASSERT(mmio->access_size == 4, "All RW to LAPIC must be 32-bits in size"); diff --git a/hypervisor/arch/x86/guest/vlapic.c b/hypervisor/arch/x86/guest/vlapic.c index ef3c4fc29..98f3b792e 100644 --- a/hypervisor/arch/x86/guest/vlapic.c +++ b/hypervisor/arch/x86/guest/vlapic.c @@ -1118,7 +1118,7 @@ vlapic_intr_accepted(struct vlapic *vlapic, int vector) int idx, stk_top; if (vlapic->ops.apicv_intr_accepted) { - (*vlapic->ops.apicv_intr_accepted)(vlapic, vector); + vlapic->ops.apicv_intr_accepted(vlapic, vector); return; } @@ -1609,14 +1609,14 @@ void vlapic_apicv_batch_set_tmr(struct vlapic *vlapic) { if (vlapic->ops.apicv_batch_set_tmr != NULL) - (*vlapic->ops.apicv_batch_set_tmr)(vlapic); + vlapic->ops.apicv_batch_set_tmr(vlapic); } void vlapic_apicv_set_tmr(struct vlapic *vlapic, int vector, bool level) { if (vlapic->ops.apicv_set_tmr != NULL) - (*vlapic->ops.apicv_set_tmr)(vlapic, vector, level); + vlapic->ops.apicv_set_tmr(vlapic, vector, level); } void