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 <huihuang.shi@intel.com>
reviewed-by: Li,Fei1 <fei1.li@intel.com>
reviewed-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Huihuang Shi 2018-06-08 15:44:19 +08:00 committed by lijinxia
parent 8940c896be
commit 6be8283334
2 changed files with 4 additions and 6 deletions

View File

@ -565,14 +565,12 @@ vioapic_pincount(struct vm *vm)
} }
int vioapic_mmio_access_handler(struct vcpu *vcpu, struct mem_io *mmio, 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; struct vm *vm = vcpu->vm;
uint64_t gpa = mmio->paddr; uint64_t gpa = mmio->paddr;
int ret = 0; int ret = 0;
(void)handler_private_data;
/* Note all RW to IOAPIC are 32-Bit in size */ /* Note all RW to IOAPIC are 32-Bit in size */
ASSERT(mmio->access_size == 4, ASSERT(mmio->access_size == 4,
"All RW to LAPIC must be 32-bits in size"); "All RW to LAPIC must be 32-bits in size");

View File

@ -1118,7 +1118,7 @@ vlapic_intr_accepted(struct vlapic *vlapic, int vector)
int idx, stk_top; int idx, stk_top;
if (vlapic->ops.apicv_intr_accepted) { if (vlapic->ops.apicv_intr_accepted) {
(*vlapic->ops.apicv_intr_accepted)(vlapic, vector); vlapic->ops.apicv_intr_accepted(vlapic, vector);
return; return;
} }
@ -1609,14 +1609,14 @@ void
vlapic_apicv_batch_set_tmr(struct vlapic *vlapic) vlapic_apicv_batch_set_tmr(struct vlapic *vlapic)
{ {
if (vlapic->ops.apicv_batch_set_tmr != NULL) if (vlapic->ops.apicv_batch_set_tmr != NULL)
(*vlapic->ops.apicv_batch_set_tmr)(vlapic); vlapic->ops.apicv_batch_set_tmr(vlapic);
} }
void void
vlapic_apicv_set_tmr(struct vlapic *vlapic, int vector, bool level) vlapic_apicv_set_tmr(struct vlapic *vlapic, int vector, bool level)
{ {
if (vlapic->ops.apicv_set_tmr != NULL) if (vlapic->ops.apicv_set_tmr != NULL)
(*vlapic->ops.apicv_set_tmr)(vlapic, vector, level); vlapic->ops.apicv_set_tmr(vlapic, vector, level);
} }
void void