HV: x86: fix "Procedure has more than one exit point"

IEC 61508, ISO 26262 standards highly recommand single-exit rule.

Tracked-On: #861
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Kaige Fu 2018-12-18 11:01:36 +00:00 committed by wenlingz
parent e283e77424
commit eff9459110
2 changed files with 19 additions and 22 deletions

View File

@ -262,13 +262,15 @@ uint8_t irq_to_pin(uint32_t irq)
uint32_t pin_to_irq(uint8_t pin)
{
uint32_t i;
uint32_t irq = IRQ_INVALID;
for (i = 0U; i < nr_gsi; i++) {
if (gsi_table[i].pin == pin) {
return i;
irq = i;
break;
}
}
return IRQ_INVALID;
return irq;
}
static void

View File

@ -60,35 +60,30 @@ static int32_t request_notification_irq(irq_action_t func, void *data)
int32_t retval;
if (notification_irq != IRQ_INVALID) {
pr_info("%s, Notification vector already allocated on this CPU",
__func__);
return -EBUSY;
}
pr_info("%s, Notification vector already allocated on this CPU", __func__);
retval = -EBUSY;
} else {
/* all cpu register the same notification vector */
retval = request_irq(NOTIFY_IRQ, func, data, IRQF_NONE);
if (retval < 0) {
pr_err("Failed to add notify isr");
return -ENODEV;
}
retval = -ENODEV;
} else {
notification_irq = (uint32_t)retval;
return 0;
}
}
return retval;
}
/*
* @pre be called only by BSP initialization process
*/
void setup_notification(void)
{
uint16_t cpu = get_cpu_id();
if (cpu > 0U) {
return;
}
/* support IPI notification, VM0 will register all CPU */
if (request_notification_irq(kick_notification, NULL) < 0) {
pr_err("Failed to setup notification");
return;
}
dev_dbg(ACRN_DBG_PTIRQ, "NOTIFY: irq[%d] setup vector %x",