[PATCH] PCI: cpcihp: Check pci_hp_add_bridge() return value

From: Majed Alkhaleefah

Date: Sun Feb 22 2026 - 21:38:03 EST


Check the return value of pci_hp_add_bridge() in cpci_configure_slot(). If
bridge initialization fails, log an error message using err().

Current functionality doesn't consider uninitialized bridges a failure.
Changing this may introduce regressions. As such, intentionally avoid
propagating the failure (e.g., returning -ENODEV).

This patch addresses an item in the cpcihp TODO list.

Compile-tested only.

Signed-off-by: Majed Alkhaleefah <majedalkhaleefah@xxxxxxxxx>
---
drivers/pci/hotplug/cpci_hotplug_pci.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
index 6c48066acb44..331c21833c44 100644
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -269,8 +269,12 @@ 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)) {
+ if (pci_hp_add_bridge(dev) != 0) {
+ err("Failed to initialize bridge %s at slot %02x",
+ pci_name(dev), slot->number);
+ }
+ }
}

pci_assign_unassigned_bridge_resources(parent->self);
--
2.43.0