[PATCH v2 2/5] PCI: cpcihp: Check pci_hp_add_bridge() return value
From: Fahmy Hassan
Date: Tue Sep 08 2026 - 22:23:21 EST
cpci_configure_slot() 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 err() macro when
pci_hp_add_bridge() fails, identifying the device involved, and
remove the now-resolved TODO entry.
Signed-off-by: Fahmy Hassan <fahmymohammed@xxxxxxxxx>
---
drivers/pci/hotplug/TODO | 4 ----
drivers/pci/hotplug/cpci_hotplug_pci.c | 5 +++--
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO
index 215ab36df11d..0a8e23546e5e 100644
--- a/drivers/pci/hotplug/TODO
+++ b/drivers/pci/hotplug/TODO
@@ -1,9 +1,5 @@
Contributions are solicited in particular to remedy the following issues:
-cpcihp:
-
-* Returned code from pci_hp_add_bridge() is not checked.
-
cpqphp:
* The driver spawns a kthread cpqhp_event_thread() which is woken by the
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
index 6c48066acb44..3deeec8dd206 100644
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -269,8 +269,9 @@ int cpci_configure_slot(struct slot *slot)
parent = slot->dev->bus;
for_each_pci_bridge(dev, parent) {
- if (PCI_SLOT(dev->devfn) == PCI_SLOT(slot->devfn))
- pci_hp_add_bridge(dev);
+ if (PCI_SLOT(dev->devfn) == PCI_SLOT(slot->devfn) &&
+ pci_hp_add_bridge(dev))
+ err("pci_hp_add_bridge(%s) failed", pci_name(dev));
}
pci_assign_unassigned_bridge_resources(parent->self);
--
2.53.0