Skip to content

Commit 902d886

Browse files
Lorenzo Pieralisibjorn-helgaas
authored andcommitted
MIPS: PCI: Fix pcibios_scan_bus() NULL check code path
If pci_scan_root_bus() fails (ie returns NULL) pcibios_scan_bus() must return immediately since the struct pci_bus pointer it returns is not valid and cannot be used. Move code checking the pci_scan_root_bus() return value to reinstate proper pcibios_scanbus() error path behaviour. Fixes: 88555b4 ("MIPS: PCI: Support for CONFIG_PCI_DOMAINS_GENERIC") Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Paul Burton <paul.burton@imgtec.com>
1 parent 16f73eb commit 902d886

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arch/mips/pci/pci-legacy.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,16 @@ static void pcibios_scanbus(struct pci_controller *hose)
8989
pci_add_resource(&resources, hose->busn_resource);
9090
bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose,
9191
&resources);
92-
hose->bus = bus;
93-
94-
need_domain_info = need_domain_info || pci_domain_nr(bus);
95-
set_pci_need_domain_info(hose, need_domain_info);
96-
9792
if (!bus) {
9893
pci_free_resource_list(&resources);
9994
return;
10095
}
10196

97+
hose->bus = bus;
98+
99+
need_domain_info = need_domain_info || pci_domain_nr(bus);
100+
set_pci_need_domain_info(hose, need_domain_info);
101+
102102
next_busno = bus->busn_res.end + 1;
103103
/* Don't allow 8-bit bus number overflow inside the hose -
104104
reserve some space for bridges. */

0 commit comments

Comments
 (0)