Skip to content

Commit 69566dd

Browse files
daviddaneyjbarnes993
authored andcommitted
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 <[email protected]> Acked-by: Benjamin Herrenschmidt <[email protected]> Acked-by: Grant Likely <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
1 parent debc3b7 commit 69566dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pci/of.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus)
5555
*/
5656
if (bus->bridge->of_node)
5757
return of_node_get(bus->bridge->of_node);
58-
if (bus->bridge->parent->of_node)
58+
if (bus->bridge->parent && bus->bridge->parent->of_node)
5959
return of_node_get(bus->bridge->parent->of_node);
6060
return NULL;
6161
}

0 commit comments

Comments
 (0)