Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5aa182a2 authored by Bjorn Helgaas's avatar Bjorn Helgaas
Browse files

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: default avatarBjorn Helgaas <bhelgaas@google.com>
parent b7f957ac
Loading
Loading
Loading
Loading
+7 −15
Original line number Original line Diff line number Diff line
@@ -38,7 +38,7 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev,


	err = devm_request_pci_bus_resources(dev, resources);
	err = devm_request_pci_bus_resources(dev, resources);
	if (err)
	if (err)
		goto out_release_res;
		return err;


	resource_list_for_each_entry(win, resources) {
	resource_list_for_each_entry(win, resources) {
		struct resource *res = win->res;
		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)) {
		switch (resource_type(res)) {
		case IORESOURCE_IO:
		case IORESOURCE_IO:
			err = pci_remap_iospace(res, iobase);
			err = pci_remap_iospace(res, iobase);
			if (err) {
			if (err)
				dev_warn(dev, "error %d: failed to map resource %pR\n",
				dev_warn(dev, "error %d: failed to map resource %pR\n",
					 err, res);
					 err, res);
				continue;
			}
			break;
			break;
		case IORESOURCE_MEM:
		case IORESOURCE_MEM:
			res_valid |= !(res->flags & IORESOURCE_PREFETCH);
			res_valid |= !(res->flags & IORESOURCE_PREFETCH);
			break;
			break;
		case IORESOURCE_BUS:
		case IORESOURCE_BUS:
			*bus_range = res;
			*bus_range = res;
		default:
			break;
			continue;
		}
		}
	}
	}


	if (!res_valid) {
	if (res_valid)
		dev_err(dev, "non-prefetchable memory resource required\n");
		err = -EINVAL;
		goto out_release_res;
	}

		return 0;
		return 0;


out_release_res:
	dev_err(dev, "non-prefetchable memory resource required\n");
	return err;
	return -EINVAL;
}
}


static void gen_pci_unmap_cfg(void *ptr)
static void gen_pci_unmap_cfg(void *ptr)