]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: Fix used_buses calculation in pci_scan_child_bus_extend()
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 5 Sep 2022 08:02:27 +0000 (11:02 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 20 Sep 2022 23:19:11 +0000 (18:19 -0500)
commitd5c0dcde50c9250752b7ba4fa4779632495bf17e
tree2e754943d54569e9de2c836ba2ffd2bc97ea8899
parent3d7dcb2c5450a57f60c448f42be48fdfe456bfdf
PCI: Fix used_buses calculation in pci_scan_child_bus_extend()

pci_scan_bridge_extend() returns the subordinate bus number needed to cover
all the buses below a bridge.  pci_scan_child_bus_extend() computes the
number of buses to reserve by comparing that with the current max bus
number.  Previously it did the subtraction in the wrong order, so
'used_buses' was nonsense.

Subtract 'max' from 'cmax' as is done for the similar
pci_scan_bridge_extend() call in the following block.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216000
Fixes: d2d4745b8652 ("PCI: Account for all bridges on bus when distributing bus numbers")
Link: https://lore.kernel.org/r/20220905080232.36087-2-mika.westerberg@linux.intel.com
Reported-by: Chris Chiu <chris.chiu@canonical.com>
Tested-by: Chris Chiu <chris.chiu@canonical.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/pci/probe.c