arm/irq: Reorder check in route_irq_to_guest() to avoid 4 layers of "if"

Remove one layer of "if" by reordering the check
in route_irq_to_guest() to make code more clearer.

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Julien Grall <julien.grall@arm.com>
This commit is contained in:
Oleksandr Tyshchenko authored and Stefano Stabellini committed 2016-12-09 11:55:14 -08:00
1 parent 28306bccb7
commit f805e59c69
1 file changed
+8 -11
+8 -11
View File
@@ -481,22 +481,19 @@ int route_irq_to_guest(struct domain *d, unsigned int virq,
{
struct domain *ad = irq_get_domain(desc);
if ( d == ad )
{
if ( irq_get_guest_info(desc)->virq != virq )
{
printk(XENLOG_G_ERR
"d%u: IRQ %u is already assigned to vIRQ %u\n",
d->domain_id, irq, irq_get_guest_info(desc)->virq);
retval = -EBUSY;
}
}
else
if ( d != ad )
{
printk(XENLOG_G_ERR "IRQ %u is already used by domain %u\n",
irq, ad->domain_id);
retval = -EBUSY;
}
else if ( irq_get_guest_info(desc)->virq != virq )
{
printk(XENLOG_G_ERR
"d%u: IRQ %u is already assigned to vIRQ %u\n",
d->domain_id, irq, irq_get_guest_info(desc)->virq);
retval = -EBUSY;
}
}
else
{
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.