[PATCH v2 1/5] PCI: cpqphp: Check pci_hp_add_bridge() return value
From: Fahmy Hassan
Date: Tue Sep 08 2026 - 22:23:57 EST
cpqhp_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/cpqphp_pci.c | 4 +++-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/hotplug/TODO b/drivers/pci/hotplug/TODO
index 7397374af171..215ab36df11d 100644
--- a/drivers/pci/hotplug/TODO
+++ b/drivers/pci/hotplug/TODO
@@ -14,8 +14,6 @@ cpqphp:
* A large portion of cpqphp_ctrl.c and cpqphp_pci.c concerns resource
management. Doesn't this duplicate functionality in the core?
-* Returned code from pci_hp_add_bridge() is not checked.
-
ibmphp:
* Implementations of hotplug_slot_ops callbacks such as get_adapter_present()
diff --git a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c
index 81c58b1ec200..34803f36ba65 100644
--- a/drivers/pci/hotplug/cpqphp_pci.c
+++ b/drivers/pci/hotplug/cpqphp_pci.c
@@ -100,7 +100,9 @@ int cpqhp_configure_device(struct controller *ctrl, struct pci_func *func)
}
if (func->pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
- pci_hp_add_bridge(func->pci_dev);
+ if (pci_hp_add_bridge(func->pci_dev))
+ err("bus/device/function %x/%x/%x: pci_hp_add_bridge() failed\n",
+ func->bus, func->device, func->function);
child = func->pci_dev->subordinate;
if (child)
pci_bus_add_devices(child);
--
2.53.0