[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v1] arm/irq: Reorder check in route_irq_to_guest() to avoid 4 layers of "if"



Hi Oleksandr,

Thank you for the patch.

On 06/12/16 17:53, Oleksandr Tyshchenko wrote:
From: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>

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@xxxxxxxx>
CC: Julien Grall <julien.grall@xxxxxxx>
---
 xen/arch/arm/irq.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 508028b..6d7e44e 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -481,21 +481,17 @@ 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 )

In Xen coding style the } and else if should be in separate line. E.g

}
else if ( ... )

With that fixed:

Reviewed-by: Julien Grall <julien.grall@xxxxxxx>

Stefano, would you be happy to fix this minor coding style issue while committing?

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.