+
--- a/arch/mips/pci/pci-legacy.c
+++ b/arch/mips/pci/pci-legacy.c
-@@ -300,3 +300,30 @@ char *__init pcibios_setup(char *str)
+@@ -300,3 +300,31 @@ char *__init pcibios_setup(char *str)
return pcibios_plat_setup(str);
return str;
}
+ int bus_nr = 0;
+ struct pci_controller *hose;
+
-+ hose = list_first_entry_or_null(&controllers, struct pci_controller, list);
++ if (!list_empty(&controllers))
++ hose = list_last_entry(&controllers, struct pci_controller, list);
+
+ if (hose != NULL) {
+ if (hose->bus != NULL) {