diff mbox

[v1,1/7] PCI: Use child bus's number instead of assuming max+1

Message ID 474aecb40e0740f687ea86d9a3d0bff3@XCGVAG27.northgrum.com
State Changes Requested
Headers show

Commit Message

Tang, Jason (ES) Sept. 17, 2015, 9:10 p.m. UTC
In pci_scan_bridge(), a newly allocated child bus's resource is given
the bus number "max+1".  The current enumeration algorithm numbers
each child sequentially, thus the new child's number happens to always
be max+1; see the call to pci_add_new_bus() a few lines earlier.

An upcoming patch will reserve bus numbers, such that the new child
bus's number might no longer be max+1.  Thus when inserting the
child's resources, use the number actually assigned to the child
instead of assuming that it is always max+1.

Signed-off-by: Jason Tang <jason.tang2@ngc.com>
---
 drivers/pci/probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index cefd636..c905db3 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -862,7 +862,7 @@  int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
 			child = pci_add_new_bus(bus, dev, max+1);
 			if (!child)
 				goto out;
-			pci_bus_insert_busn_res(child, max+1, 0xff);
+			pci_bus_insert_busn_res(child, child->number, 0xff);
 		}
 		max++;
 		buses = (buses & 0xff000000)