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

[xen staging] x86/irq: tidy switch statement and address MISRA violation



commit 24f204748ef978eba6ae4f83bb5b7daacab5acb1
Author:     Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
AuthorDate: Fri Apr 5 11:14:31 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Apr 11 13:23:08 2024 +0100

    x86/irq: tidy switch statement and address MISRA violation
    
    Refactor the clauses so that a MISRA C Rule 16.2 violation is resolved
    (A switch label shall only be used when the most closely-enclosing
    compound statement is the body of a switch statement).
    Note that the switch clause ending with the pseudo keyword "fallthrough"
    is an allowed exception to Rule 16.3.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/irq.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index a042faf104..80ba8d9fe9 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2882,7 +2882,7 @@ int allocate_and_map_gsi_pirq(struct domain *d, int 
index, int *pirq_p)
 int allocate_and_map_msi_pirq(struct domain *d, int index, int *pirq_p,
                               int type, struct msi_info *msi)
 {
-    int irq, pirq, ret;
+    int irq = -1, pirq, ret;
 
     ASSERT_PDEV_LIST_IS_READ_LOCKED(d);
 
@@ -2892,11 +2892,10 @@ int allocate_and_map_msi_pirq(struct domain *d, int 
index, int *pirq_p,
         if ( !msi->table_base )
             msi->entry_nr = 1;
         irq = index;
-        if ( irq == -1 )
-        {
+        fallthrough;
     case MAP_PIRQ_TYPE_MULTI_MSI:
+        if( irq == -1 )
             irq = create_irq(NUMA_NO_NODE, true);
-        }
 
         if ( irq < nr_irqs_gsi || irq >= nr_irqs )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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