Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69566dd8 authored by David Daney's avatar David Daney Committed by Jesse Barnes
Browse files

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: default avatarDavid Daney <david.daney@cavium.com>
Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent debc3b77
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
}