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: MMI-PSA29.97-13-9~18535^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=69566dd8be42dea7a22f625abc96e65bb4b45d1f;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.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; }