Commit 1ce76bc0 authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by Bjorn Helgaas
Browse files

PCI: Refactor find_bus_resource_of_type() logic checks



Reorder the logic checks in find_bus_resource_of_type() to simplify them.

Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20250829131113.36754-6-ilpo.jarvinen@linux.intel.com
parent e240edff
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -158,11 +158,15 @@ static struct resource *find_bus_resource_of_type(struct pci_bus *bus,
	struct resource *r, *r_assigned = NULL;

	pci_bus_for_each_resource(bus, r) {
		if (r == &ioport_resource || r == &iomem_resource)
		if (!r || r == &ioport_resource || r == &iomem_resource)
			continue;
		if (r && (r->flags & type_mask) == type && !r->parent)

		if ((r->flags & type_mask) != type)
			continue;

		if (!r->parent)
			return r;
		if (r && (r->flags & type_mask) == type && !r_assigned)
		if (!r_assigned)
			r_assigned = r;
	}
	return r_assigned;