summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2024-10-17 17:11:10 +0300
committerBjorn Helgaas <bhelgaas@google.com>2024-10-18 13:35:33 -0500
commit32ec7b362d904c1e67f8e64524fb0b6c43d5c9c2 (patch)
tree42e7d5c6e201012597f9884b357ed1b4caebed42
parent469c9cb941480718db52876bbdb95a7a79b34889 (diff)
downloadlwn-32ec7b362d904c1e67f8e64524fb0b6c43d5c9c2.tar.gz
lwn-32ec7b362d904c1e67f8e64524fb0b6c43d5c9c2.zip
PCI: Simplify pci_read_bridge_bases() logic
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>
-rw-r--r--drivers/pci/probe.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 4243b1e6ece2..f9524b90bdbc 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -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);
}
}