qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 10/13] pci: Fix coding style of pci_parse_devaddr


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH 10/13] pci: Fix coding style of pci_parse_devaddr
Date: Mon, 4 Jun 2012 10:52:18 +0200

So that we can move it unmodified without raising alarms. No functional
changes.

Signed-off-by: Jan Kiszka <address@hidden>
---
 hw/pci.c |   52 ++++++++++++++++++++++++++++------------------------
 1 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 4d700a9..62ad61c 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -524,43 +524,47 @@ int pci_parse_devaddr(const char *addrstr, 
PCIDeviceAddress *addr,
 
     p = addrstr;
     val = strtoul(p, &e, 16);
-    if (e == p)
-       return -1;
+    if (e == p) {
+        return -1;
+    }
     if (*e == ':') {
-       bus = val;
-       p = e + 1;
-       val = strtoul(p, &e, 16);
-       if (e == p)
-           return -1;
-       if (*e == ':') {
-           dom = bus;
-           bus = val;
-           p = e + 1;
-           val = strtoul(p, &e, 16);
-           if (e == p)
-               return -1;
-       }
+        bus = val;
+        p = e + 1;
+        val = strtoul(p, &e, 16);
+        if (e == p) {
+            return -1;
+        }
+        if (*e == ':') {
+            dom = bus;
+            bus = val;
+            p = e + 1;
+            val = strtoul(p, &e, 16);
+            if (e == p) {
+                return -1;
+            }
+        }
     }
 
     slot = val;
 
     if (flags & PCI_DEVADDR_WITH_FUNC) {
-        if (*e != '.')
+        if (*e != '.') {
             return -1;
-
+        }
         p = e + 1;
         val = strtoul(p, &e, 16);
-        if (e == p)
+        if (e == p) {
             return -1;
-
+        }
         func = val;
     }
 
-    if (dom > 0xffff || bus > 0xff || slot > 0x1f || func > 7)
-       return -1;
-
-    if (*e)
-       return -1;
+    if (dom > 0xffff || bus > 0xff || slot > 0x1f || func > 7) {
+        return -1;
+    }
+    if (*e) {
+        return -1;
+    }
 
     addr->domain = dom;
     addr->bus = bus;
-- 
1.7.3.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]