[PATCH v2 4/5] PCI: pciehp: Check pci_hp_add_bridge() return value
From: Fahmy Hassan
Date: Tue Sep 08 2026 - 22:24:09 EST
pciehp_configure_device() calls pci_hp_add_bridge() for each bridge on
the newly added slot without checking its return value.
pci_hp_add_bridge() already logs an error for one failure path (no
bus number available for the hot-added bridge), but returns silently
if the bridge's subordinate bus isn't created after scanning -- that
path goes completely unreported, and either way the caller currently
has no way to notice or react to the failure.
Log an error via the driver's existing ctrl_err() macro when
pci_hp_add_bridge() fails, identifying the device involved.
Signed-off-by: Fahmy Hassan <fahmymohammed@xxxxxxxxx>
---
drivers/pci/hotplug/pciehp_pci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c
index 65e50bee1a8c..cbdfde557f3b 100644
--- a/drivers/pci/hotplug/pciehp_pci.c
+++ b/drivers/pci/hotplug/pciehp_pci.c
@@ -59,7 +59,8 @@ int pciehp_configure_device(struct controller *ctrl)
}
for_each_pci_bridge(dev, parent)
- pci_hp_add_bridge(dev);
+ if (pci_hp_add_bridge(dev))
+ ctrl_err(ctrl, "pci_hp_add_bridge(%s) failed\n", pci_name(dev));
pci_assign_unassigned_bridge_resources(bridge);
pcie_bus_configure_settings(parent);
--
2.53.0