From: David Daney Date: Tue, 16 Aug 2011 18:24:37 +0000 (-0700) Subject: PCI: OF: Don't crash when bridge parent is NULL. X-Git-Tag: Ubuntu-5.0.0-8.9~17840^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=69566dd8be42dea7a22f625abc96e65bb4b45d1f;p=mirror_ubuntu-disco-kernel.git PCI: OF: Don't crash when bridge parent is NULL. In pcibios_get_phb_of_node(), we will crash while booting if bus->bridge->parent is NULL. Check for this case and avoid dereferencing the NULL pointer. Signed-off-by: David Daney Acked-by: Benjamin Herrenschmidt Acked-by: Grant Likely Signed-off-by: Jesse Barnes --- diff --git a/drivers/pci/of.c b/drivers/pci/of.c index c94d37ec55c8..f0929934bb7a 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -55,7 +55,7 @@ struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus) */ if (bus->bridge->of_node) return of_node_get(bus->bridge->of_node); - if (bus->bridge->parent->of_node) + if (bus->bridge->parent && bus->bridge->parent->of_node) return of_node_get(bus->bridge->parent->of_node); return NULL; }