[PATCH v2] PCI: of_property: Omit bus properties without a subordinate bus
From: Angel J
Date: Sat Sep 12 2026 - 00:32:50 EST
A device can satisfy pci_is_bridge() without having a subordinate bus.
The dynamic OF helpers for bus-range and interrupt-map dereference
pdev->subordinate without checking it.
On a Dell XPS 8940, device 0000:00:00.0 [8086:4c43] has no subordinate
bus, and enabling CONFIG_PCI_DYNAMIC_OF_NODES causes an early boot hang.
Generate bus-range and interrupt-map only when a subordinate bus exists.
Keep the node and its remaining properties for bridges without one.
Boot-tested on Linux 6.18.44 with CONFIG_PCI_DYNAMIC_OF_NODES=y. The
system boots and the node for 00:00.0 retains device_type, reg and
compatible. The other bridges retain their nodes and bus ranges.
Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Angel J <iamanaws@xxxxxxxxx>
---
Changes in v2:
- Keep the dynamic OF node and skip only bus-range and interrupt-map
when no subordinate bus exists, following review of v1.
- Tested on Linux 6.18.44 with the v1 guard removed.
drivers/pci/of_property.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c
index 75a358f73..acd2e0f70 100644
--- a/drivers/pci/of_property.c
+++ b/drivers/pci/of_property.c
@@ -361,13 +361,15 @@ int of_pci_add_properties(struct pci_dev *pdev, struct of_changeset *ocs,
if (ret)
return ret;
- ret = of_pci_prop_bus_range(pdev, ocs, np);
- if (ret)
- return ret;
+ if (pdev->subordinate) {
+ ret = of_pci_prop_bus_range(pdev, ocs, np);
+ if (ret)
+ return ret;
- ret = of_pci_prop_intr_map(pdev, ocs, np);
- if (ret)
- return ret;
+ ret = of_pci_prop_intr_map(pdev, ocs, np);
+ if (ret)
+ return ret;
+ }
} else {
ret = of_pci_prop_intr_ctrl(pdev, ocs, np);
if (ret)
--
2.54.0