HV: fix MISRA issue in apicv_pending_intr()
Remove multi-return statement in apicv_pending_intr().
Acked-by: Eddie Dong
@@ -2291,32 +2291,37 @@ apicv_pending_intr(const struct acrn_vlapic *vlapic)
const struct lapic_regs *lapic;
uint64_t pending, pirval;
uint32_t i, ppr, vpr;
+ int32_t ret = 0;
pir_desc = &(vlapic->pir_desc);
pending = atomic_load64(&pir_desc->pending);
- if (pending == 0U) {
- return 0;
- }
-
+ if (pending != 0U) {
lapic = &(vlapic->apic_page);
ppr = lapic->ppr.v & 0xF0U;
if (ppr == 0U) {
- return 1;
- }
+ ret = 1;
+ } else {
/* i ranges effectively from 3 to 0 */
- for (i = 4U; i > 0U; ) {
+ i = 4U;
+ while (i > 0U) {
i --;
+ if (pir_desc->pir[i] != 0U) {
+ break;
+ }
+ }
+
pirval = pir_desc->pir[i];
if (pirval != 0U) {
vpr = (((i * 64U) + (uint32_t)fls64(pirval)) & 0xF0U);
- return (vpr > ppr) ? 1 : 0;
+ ret = ((vpr > ppr) ? 1 : 0);
+ }
}
}
- return 0;
+ return ret;
}
/* Update the VMX_EOI_EXIT according to related tmr */
