]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: Simplify pci_read_bridge_bases() logic
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 17 Oct 2024 14:11:10 +0000 (17:11 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 18 Oct 2024 18:35:33 +0000 (13:35 -0500)
Use reverse logic combined with return and continue to significantly
reduce indentation level in pci_read_bridge_bases().

Link: https://lore.kernel.org/r/20241017141111.44612-3-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/pci/probe.c

index 4243b1e6ece26cd6f1fb3de0a22e247b1119ff74..f9524b90bdbcc6bce6262c6f75d705caa0125810 100644 (file)
@@ -543,14 +543,15 @@ void pci_read_bridge_bases(struct pci_bus *child)
        pci_read_bridge_mmio(child->self, child->resource[1], false);
        pci_read_bridge_mmio_pref(child->self, child->resource[2], false);
 
-       if (dev->transparent) {
-               pci_bus_for_each_resource(child->parent, res) {
-                       if (res && res->flags) {
-                               pci_bus_add_resource(child, res);
-                               pci_info(dev, "  bridge window %pR (subtractive decode)\n",
-                                          res);
-                       }
-               }
+       if (!dev->transparent)
+               return;
+
+       pci_bus_for_each_resource(child->parent, res) {
+               if (!res || !res->flags)
+                       continue;
+
+               pci_bus_add_resource(child, res);
+               pci_info(dev, "  bridge window %pR (subtractive decode)\n", res);
        }
 }