PCI: versatile: Simplify host bridge window iteration
authorBjorn Helgaas <bhelgaas@google.com>
Sat, 28 May 2016 23:31:26 +0000 (18:31 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Sat, 25 Jun 2016 12:44:24 +0000 (07:44 -0500)
The switch is the only statement in the resource_list_for_each_entry()
loop, so remove unnecessary "continue" statements in the switch.  Simplify
checking for the required non-prefetchable memory aperture.

No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/host/pci-versatile.c

index 273edaca8f49b58111347aad159571dba8434353..f234405770abf0c8dd1dd66a58687a4e182cdf05 100644 (file)
@@ -90,11 +90,9 @@ static int versatile_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);
@@ -104,19 +102,14 @@ static int versatile_pci_parse_request_of_pci_ranges(struct device *dev,
                        mem++;
 
                        break;
-               case IORESOURCE_BUS:
-               default:
-                       continue;
                }
        }
 
-       if (!res_valid) {
-               dev_err(dev, "non-prefetchable memory resource required\n");
-               err = -EINVAL;
-               goto out_release_res;
-       }
+       if (res_valid)
+               return 0;
 
-       return 0;
+       dev_err(dev, "non-prefetchable memory resource required\n");
+       err = -EINVAL;
 
 out_release_res:
        pci_free_resource_list(res);