提交 4a5954ed 编写于 作者: G Gavin Shan 提交者: Michael Ellerman

powerpc/pci: Don't scan empty slot

In hotplug case, function pci_add_pci_devices() is called to rescan
the specified PCI bus, which might not have any child devices. Access
to the PCI bus's child device node will cause kernel crash without
exception.

This adds one more check to skip scanning PCI bus that doesn't have
any subordinate devices from device-tree, in order to avoid kernel
crash.
Signed-off-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 cdddc577
...@@ -120,7 +120,8 @@ void pci_hp_add_devices(struct pci_bus *bus) ...@@ -120,7 +120,8 @@ void pci_hp_add_devices(struct pci_bus *bus)
if (mode == PCI_PROBE_DEVTREE) { if (mode == PCI_PROBE_DEVTREE) {
/* use ofdt-based probe */ /* use ofdt-based probe */
of_rescan_bus(dn, bus); of_rescan_bus(dn, bus);
} else if (mode == PCI_PROBE_NORMAL) { } else if (mode == PCI_PROBE_NORMAL &&
dn->child && PCI_DN(dn->child)) {
/* /*
* Use legacy probe. In the partial hotplug case, we * Use legacy probe. In the partial hotplug case, we
* probably have grandchildren devices unplugged. So * probably have grandchildren devices unplugged. So
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册