2d1356
From 3b9712c09ff6ac00d5d371f3e1e71391037eb5bf Mon Sep 17 00:00:00 2001
2d1356
Message-Id: <3b9712c09ff6ac00d5d371f3e1e71391037eb5bf@dist-git>
2d1356
From: Martin Kletzander <mkletzan@redhat.com>
2d1356
Date: Mon, 23 May 2016 18:10:03 +0200
2d1356
Subject: [PATCH] nodedev: Indent PCI express for future fix
2d1356
2d1356
RHEL-7.2.z: https://bugzilla.redhat.com/show_bug.cgi?id=1331328
2d1356
2d1356
Best viewed with '-w' as this is just an adjustment for future patch to
2d1356
be readable without that.
2d1356
2d1356
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2d1356
(cherry picked from commit 0d8f45246a74b627e62eccef2bb19068690312e2)
2d1356
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2d1356
---
2d1356
 src/node_device/node_device_udev.c | 38 ++++++++++++++++++++------------------
2d1356
 1 file changed, 20 insertions(+), 18 deletions(-)
2d1356
2d1356
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
2d1356
index 100b44d..aaee0e5 100644
2d1356
--- a/src/node_device/node_device_udev.c
2d1356
+++ b/src/node_device/node_device_udev.c
2d1356
@@ -505,28 +505,30 @@ static int udevProcessPCI(struct udev_device *device,
2d1356
         goto out;
2d1356
 
2d1356
     /* We need to be root to read PCI device configs */
2d1356
-    if (priv->privileged && virPCIDeviceIsPCIExpress(pciDev) > 0) {
2d1356
-        if (VIR_ALLOC(pci_express) < 0)
2d1356
-            goto out;
2d1356
-
2d1356
-        if (virPCIDeviceHasPCIExpressLink(pciDev) > 0) {
2d1356
-            if (VIR_ALLOC(pci_express->link_cap) < 0 ||
2d1356
-                VIR_ALLOC(pci_express->link_sta) < 0)
2d1356
+    if (priv->privileged) {
2d1356
+        if (virPCIDeviceIsPCIExpress(pciDev) > 0) {
2d1356
+            if (VIR_ALLOC(pci_express) < 0)
2d1356
                 goto out;
2d1356
 
2d1356
-            if (virPCIDeviceGetLinkCapSta(pciDev,
2d1356
-                                          &pci_express->link_cap->port,
2d1356
-                                          &pci_express->link_cap->speed,
2d1356
-                                          &pci_express->link_cap->width,
2d1356
-                                          &pci_express->link_sta->speed,
2d1356
-                                          &pci_express->link_sta->width) < 0)
2d1356
-                goto out;
2d1356
+            if (virPCIDeviceHasPCIExpressLink(pciDev) > 0) {
2d1356
+                if (VIR_ALLOC(pci_express->link_cap) < 0 ||
2d1356
+                    VIR_ALLOC(pci_express->link_sta) < 0)
2d1356
+                    goto out;
2d1356
+
2d1356
+                if (virPCIDeviceGetLinkCapSta(pciDev,
2d1356
+                                              &pci_express->link_cap->port,
2d1356
+                                              &pci_express->link_cap->speed,
2d1356
+                                              &pci_express->link_cap->width,
2d1356
+                                              &pci_express->link_sta->speed,
2d1356
+                                              &pci_express->link_sta->width) < 0)
2d1356
+                    goto out;
2d1356
 
2d1356
-            pci_express->link_sta->port = -1; /* PCIe can't negotiate port. Yet :) */
2d1356
+                pci_express->link_sta->port = -1; /* PCIe can't negotiate port. Yet :) */
2d1356
+            }
2d1356
+            data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCIE;
2d1356
+            data->pci_dev.pci_express = pci_express;
2d1356
+            pci_express = NULL;
2d1356
         }
2d1356
-        data->pci_dev.flags |= VIR_NODE_DEV_CAP_FLAG_PCIE;
2d1356
-        data->pci_dev.pci_express = pci_express;
2d1356
-        pci_express = NULL;
2d1356
     }
2d1356
 
2d1356
     ret = 0;
2d1356
-- 
2d1356
2.8.3
2d1356