diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2016-05-03 07:41:43 +0200 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-05-11 13:54:26 +0200 |
commit | 4a5954ed7726497415ae49204cfc8e38ee8b127e (patch) | |
tree | 45ef94517c22c7d80cddafe8220d4b14be0026fb /arch/powerpc | |
parent | powerpc/pci: Export pci_traverse_device_nodes() (diff) | |
download | linux-4a5954ed7726497415ae49204cfc8e38ee8b127e.tar.xz linux-4a5954ed7726497415ae49204cfc8e38ee8b127e.zip |
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: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/pci-hotplug.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c index 46587a14dd94..2d71269e7dc1 100644 --- a/arch/powerpc/kernel/pci-hotplug.c +++ b/arch/powerpc/kernel/pci-hotplug.c @@ -120,7 +120,8 @@ void pci_hp_add_devices(struct pci_bus *bus) if (mode == PCI_PROBE_DEVTREE) { /* use ofdt-based probe */ 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 * probably have grandchildren devices unplugged. So |