summaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2016-05-28 18:28:51 -0500
committerBjorn Helgaas <bhelgaas@google.com>2016-06-21 10:10:37 -0500
commit5aa182a26ca6b2427473d9c61e369c860fca628c (patch)
tree3f54d5f7b1590c55e4129f41e7d98371c62c9df0 /drivers/pci
parentb7f957ac272cb6f7a36536a1801b4da453df9c9b (diff)
downloadop-kernel-dev-5aa182a26ca6b2427473d9c61e369c860fca628c.zip
op-kernel-dev-5aa182a26ca6b2427473d9c61e369c860fca628c.tar.gz
PCI: generic: Simplify host bridge window iteration
The switch is the only statement in the resource_list_for_each_entry() loop, so remove unnecessary "continue" statements in the switch. Remove unnecessary "goto" statements and label. Simplify checking for the required non-prefetchable memory aperture. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/host/pci-host-common.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/pci/host/pci-host-common.c b/drivers/pci/host/pci-host-common.c
index 533d50c..5852c40 100644
--- a/drivers/pci/host/pci-host-common.c
+++ b/drivers/pci/host/pci-host-common.c
@@ -38,7 +38,7 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev,
err = devm_request_pci_bus_resources(dev, resources);
if (err)
- goto out_release_res;
+ return err;
resource_list_for_each_entry(win, resources) {
struct resource *res = win->res;
@@ -46,32 +46,24 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev,
switch (resource_type(res)) {
case IORESOURCE_IO:
err = pci_remap_iospace(res, iobase);
- if (err) {
+ if (err)
dev_warn(dev, "error %d: failed to map resource %pR\n",
err, res);
- continue;
- }
break;
case IORESOURCE_MEM:
res_valid |= !(res->flags & IORESOURCE_PREFETCH);
break;
case IORESOURCE_BUS:
*bus_range = res;
- default:
- continue;
+ break;
}
}
- if (!res_valid) {
- dev_err(dev, "non-prefetchable memory resource required\n");
- err = -EINVAL;
- goto out_release_res;
- }
-
- return 0;
+ if (res_valid)
+ return 0;
-out_release_res:
- return err;
+ dev_err(dev, "non-prefetchable memory resource required\n");
+ return -EINVAL;
}
static void gen_pci_unmap_cfg(void *ptr)
OpenPOWER on IntegriCloud