mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
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:
1 parent
28306bccb7
commit
f805e59c69
1 file changed
+8
-11
+8
-11
@@ -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
|
||||
{
|
||||
|
||||