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 <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60876
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jonathan Zhang <jonzhang@fb.com>
diff --git a/src/device/pci_device.c b/src/device/pci_device.c
index a61fbd6..ed95dff 100644
--- a/src/device/pci_device.c
+++ b/src/device/pci_device.c
@@ -1216,6 +1216,9 @@
 	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;