]> Git Repo - linux.git/commitdiff
PCI: OF: Don't crash when bridge parent is NULL.
authorDavid Daney <[email protected]>
Tue, 16 Aug 2011 18:24:37 +0000 (11:24 -0700)
committerJesse Barnes <[email protected]>
Fri, 19 Aug 2011 15:51:37 +0000 (08:51 -0700)
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 <[email protected]>
Acked-by: Benjamin Herrenschmidt <[email protected]>
Acked-by: Grant Likely <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
drivers/pci/of.c

index c94d37ec55c87af38e7b6d1c9ccf46ea9baeb60c..f0929934bb7ac0c8a5d0dca4dbb197fb4700b6d3 100644 (file)
@@ -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;
 }
This page took 0.054957 seconds and 4 git commands to generate.