mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] PCI: cpqphp: Check pci_hp_add_bridge() return value
@ 2026-09-09  1:30 Fahmy Hassan
  2026-09-09  1:41 ` Bjorn Helgaas
  0 siblings, 1 reply; 10+ messages in thread
From: Fahmy Hassan @ 2026-09-09  1:30 UTC (permalink / raw)
  To: bhelgaas, fahmymohammed, kees, linux-pci, linux-kernel

cpqhp_configure_device() calls pci_hp_add_bridge() without checking
its return value. If pci_hp_add_bridge() fails (e.g. no bus number
is available for the hot-added bridge), dev->subordinate is left
unset, so the subsequent pci_bus_add_devices(child) call is
correctly skipped -- but the failure itself goes completely
unreported, making such problems very hard to diagnose in the field.

Log an error via the driver's existing err() macro when
pci_hp_add_bridge() fails, and remove the now-resolved TODO entry.

Signed-off-by: Fahmy Hassan <fahmymohammed@gmail.com>
---
 drivers/pci/hotplug/cpqphp_pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-09-09  6:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09  1:30 [PATCH v1] PCI: cpqphp: Check pci_hp_add_bridge() return value Fahmy Hassan
2026-09-09  1:41 ` Bjorn Helgaas
2026-09-09  2:17   ` Fahmy Hassan
2026-09-09  2:22   ` [PATCH v2 0/5] PCI: hotplug: " Fahmy Hassan
2026-09-09  2:22     ` [PATCH v2 1/5] PCI: cpqphp: " Fahmy Hassan
2026-09-09  2:22     ` [PATCH v2 2/5] PCI: cpcihp: " Fahmy Hassan
2026-09-09  2:22     ` [PATCH v2 3/5] PCI: ibmphp: " Fahmy Hassan
2026-09-09  2:22     ` [PATCH v2 4/5] PCI: pciehp: " Fahmy Hassan
2026-09-09  6:42       ` Lukas Wunner
2026-09-09  2:22     ` [PATCH v2 5/5] PCI: shpchp: " Fahmy Hassan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®