aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorAndreas Noever <andreas.noever@gmail.com>2014-01-23 15:59:21 -0500
committerBjorn Helgaas <bhelgaas@google.com>2014-02-10 18:50:49 -0500
commit9a4d7d87197e3ff9138981e196aa5021d13a51a8 (patch)
treed2cd45ba70567f351ae465322d4844905d181296 /drivers/pci
parent38dbfb59d1175ef458d006556061adeaa8751b72 (diff)
PCI: Increment max correctly in pci_scan_bridge()
This patch fixes two small issues: - If pci_add_new_bus() fails, max must not be incremented. Otherwise an incorrect value is returned from pci_scan_bridge(). - If the bus is already present, max must be incremented. I think that this case should only be hit if we trigger a manual rescan of a CardBus bridge. Signed-off-by: Andreas Noever <andreas.noever@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/probe.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 6e34498ec9f0..f340c947d8cb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -852,11 +852,12 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
852 * this case we only re-scan this bus. */ 852 * this case we only re-scan this bus. */
853 child = pci_find_bus(pci_domain_nr(bus), max+1); 853 child = pci_find_bus(pci_domain_nr(bus), max+1);
854 if (!child) { 854 if (!child) {
855 child = pci_add_new_bus(bus, dev, ++max); 855 child = pci_add_new_bus(bus, dev, max+1);
856 if (!child) 856 if (!child)
857 goto out; 857 goto out;
858 pci_bus_insert_busn_res(child, max, 0xff); 858 pci_bus_insert_busn_res(child, max+1, 0xff);
859 } 859 }
860 max++;
860 buses = (buses & 0xff000000) 861 buses = (buses & 0xff000000)
861 | ((unsigned int)(child->primary) << 0) 862 | ((unsigned int)(child->primary) << 0)
862 | ((unsigned int)(child->busn_res.start) << 8) 863 | ((unsigned int)(child->busn_res.start) << 8)