Commit 6ae8aedf authored by Oliver O'Halloran's avatar Oliver O'Halloran Committed by Michael Ellerman

powerpc/powernv/pci: Sprinkle around some WARN_ON()s

pnv_pci_ioda_configure_bus() should now only ever be called when a device is
added to the bus so add a WARN_ON() to the empty bus check. Similarly,
pnv_pci_ioda_setup_bus_PE() should only ever be called for an unconfigured PE,
so add a WARN_ON() for that case too.
Signed-off-by: default avatarOliver O'Halloran <oohall@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200417073508.30356-5-oohall@gmail.com
parent 718d249a
...@@ -1139,7 +1139,7 @@ static struct pnv_ioda_pe *pnv_ioda_setup_bus_PE(struct pci_bus *bus, bool all) ...@@ -1139,7 +1139,7 @@ static struct pnv_ioda_pe *pnv_ioda_setup_bus_PE(struct pci_bus *bus, bool all)
* We should reuse it instead of allocating a new one. * We should reuse it instead of allocating a new one.
*/ */
pe_num = phb->ioda.pe_rmap[bus->number << 8]; pe_num = phb->ioda.pe_rmap[bus->number << 8];
if (pe_num != IODA_INVALID_PE) { if (WARN_ON(pe_num != IODA_INVALID_PE)) {
pe = &phb->ioda.pe_array[pe_num]; pe = &phb->ioda.pe_array[pe_num];
return NULL; return NULL;
} }
...@@ -3199,7 +3199,7 @@ static void pnv_pci_configure_bus(struct pci_bus *bus) ...@@ -3199,7 +3199,7 @@ static void pnv_pci_configure_bus(struct pci_bus *bus)
dev_info(&bus->dev, "Configuring PE for bus\n"); dev_info(&bus->dev, "Configuring PE for bus\n");
/* Don't assign PE to PCI bus, which doesn't have subordinate devices */ /* Don't assign PE to PCI bus, which doesn't have subordinate devices */
if (list_empty(&bus->devices)) if (WARN_ON(list_empty(&bus->devices)))
return; return;
/* Reserve PEs according to used M64 resources */ /* Reserve PEs according to used M64 resources */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment