HV: cycomatic complexity 20 in vlapic_icrlo_write_handler
MISRA compaint that the vlapic_icrlo_write_handler 's cyclomatic complexity is greater than 20. Try to remove multiple returns/exits. 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
eaa0e307b7
commit
0884397361
|
@ -1229,6 +1229,7 @@ vlapic_icrlo_write_handler(struct acrn_vlapic *vlapic)
|
||||||
{
|
{
|
||||||
uint16_t vcpu_id;
|
uint16_t vcpu_id;
|
||||||
bool phys;
|
bool phys;
|
||||||
|
int32_t ret = 0;
|
||||||
uint64_t dmask = 0UL;
|
uint64_t dmask = 0UL;
|
||||||
uint32_t icr_low, icr_high, dest;
|
uint32_t icr_low, icr_high, dest;
|
||||||
uint32_t vec, mode, shorthand;
|
uint32_t vec, mode, shorthand;
|
||||||
|
@ -1253,20 +1254,16 @@ vlapic_icrlo_write_handler(struct acrn_vlapic *vlapic)
|
||||||
if ((mode == APIC_DELMODE_FIXED) && (vec < 16U)) {
|
if ((mode == APIC_DELMODE_FIXED) && (vec < 16U)) {
|
||||||
vlapic_set_error(vlapic, APIC_ESR_SEND_ILLEGAL_VECTOR);
|
vlapic_set_error(vlapic, APIC_ESR_SEND_ILLEGAL_VECTOR);
|
||||||
dev_dbg(ACRN_DBG_LAPIC, "Ignoring invalid IPI %u", vec);
|
dev_dbg(ACRN_DBG_LAPIC, "Ignoring invalid IPI %u", vec);
|
||||||
return 0;
|
} else if (((shorthand == APIC_DEST_SELF) || (shorthand == APIC_DEST_ALLISELF))
|
||||||
}
|
&& ((mode == APIC_DELMODE_NMI) || (mode == APIC_DELMODE_INIT)
|
||||||
|
|| (mode == APIC_DELMODE_STARTUP))) {
|
||||||
|
dev_dbg(ACRN_DBG_LAPIC, "Invalid ICR value");
|
||||||
|
} else {
|
||||||
|
|
||||||
dev_dbg(ACRN_DBG_LAPIC,
|
dev_dbg(ACRN_DBG_LAPIC,
|
||||||
"icrlo 0x%08x icrhi 0x%08x triggered ipi %u",
|
"icrlo 0x%08x icrhi 0x%08x triggered ipi %u",
|
||||||
icr_low, icr_high, vec);
|
icr_low, icr_high, vec);
|
||||||
|
|
||||||
if (((shorthand == APIC_DEST_SELF) || (shorthand == APIC_DEST_ALLISELF))
|
|
||||||
&& ((mode == APIC_DELMODE_NMI) || (mode == APIC_DELMODE_INIT)
|
|
||||||
|| (mode == APIC_DELMODE_STARTUP))) {
|
|
||||||
dev_dbg(ACRN_DBG_LAPIC, "Invalid ICR value");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (shorthand) {
|
switch (shorthand) {
|
||||||
case APIC_DEST_DESTFLD:
|
case APIC_DEST_DESTFLD:
|
||||||
vlapic_calcdest(vlapic->vm, &dmask, dest, phys, false);
|
vlapic_calcdest(vlapic->vm, &dmask, dest, phys, false);
|
||||||
|
@ -1313,8 +1310,9 @@ vlapic_icrlo_write_handler(struct acrn_vlapic *vlapic)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0; /* handled completely in the kernel */
|
return ret; /* handled completely in the kernel */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue