[PATCH v2 3/5] PCI: ibmphp: Check pci_hp_add_bridge() return value

From: Fahmy Hassan

Date: Tue Sep 08 2026 - 22:24:37 EST


ibm_configure_device() calls pci_hp_add_bridge() 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 | 2 --
drivers/pci/hotplug/ibmphp_core.c | 3 ++-
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO
index 0a8e23546e5e..2a4f44f9b629 100644
--- a/drivers/pci/hotplug/TODO
+++ b/drivers/pci/hotplug/TODO
@@ -37,8 +37,6 @@ ibmphp:
* A large portion of ibmphp_res.c and ibmphp_pci.c concerns resource
management. Doesn't this duplicate functionality in the core?

-* Returned code from pci_hp_add_bridge() is not checked.
-
shpchp:

* The hardirq handler shpc_isr() queues events on a workqueue. It can be
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index aca86c092d4a..b653d3068677 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -690,7 +690,8 @@ static int ibm_configure_device(struct pci_func *func)
}
}
if (!(flag) && (func->dev->hdr_type == PCI_HEADER_TYPE_BRIDGE)) {
- pci_hp_add_bridge(func->dev);
+ if (pci_hp_add_bridge(func->dev))
+ err("pci_hp_add_bridge(%s) failed\n", pci_name(func->dev));
child = func->dev->subordinate;
if (child)
pci_bus_add_devices(child);
--
2.53.0