From db199cc0735d009f95cbb4eb2b9d422dad509203 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Thu, 6 Jan 2022 20:56:01 +0100 Subject: [PATCH] device/pci_device.c: Make sure the PCI bus has a device Some SOC add PCI root busses structs at runtime without adding a device struct to the bus because pci_scan_bus does it. An example would be xeon_sp which has multiple root busses. TEST: ocp/deltalake boots again. Change-Id: I81d9c94652e34dbf9e8cec64fc34ef0042563037 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/60876 Tested-by: build bot (Jenkins) Reviewed-by: Jonathan Zhang --- src/device/pci_device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/device/pci_device.c b/src/device/pci_device.c index a61fbd6c49..ed95dff953 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -1216,6 +1216,9 @@ static bool pci_bus_only_one_child(struct bus *bus) u16 pcie_pos, pcie_flags_reg; int pcie_type; + if (!bridge) + return false; + pcie_pos = pci_find_capability(bridge, PCI_CAP_ID_PCIE); if (!pcie_pos) return false;