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

[XEN PATCH 06/11] xen/ioreq: move variable declaration to address MISRA C:2012 Rule 2.1



Variable declarations between a switch statement guard and before
any case label are unreachable code, and hence violate Rule 2.1:
"A project shall not contain unreachable code".

Therefore the variable declarations are moved in the smallest enclosing
scope, near other variable definitions.

Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
---
 xen/common/ioreq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c
index 7cb717f7a2..5044f43b81 100644
--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -1111,6 +1111,7 @@ struct ioreq_server *ioreq_server_select(struct domain *d,
     FOR_EACH_IOREQ_SERVER(d, id, s)
     {
         struct rangeset *r;
+        unsigned long start, end;
 
         if ( !s->enabled )
             continue;
@@ -1119,8 +1120,6 @@ struct ioreq_server *ioreq_server_select(struct domain *d,
 
         switch ( type )
         {
-            unsigned long start, end;
-
         case XEN_DMOP_IO_RANGE_PORT:
             start = addr;
             end = start + p->size - 1;
-- 
2.34.1




 


Rackspace

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