mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] PCI: cpcihp: Check pci_hp_add_bridge() return value
@ 2026-02-23  2:36 Majed Alkhaleefah
  2026-02-23 17:26 ` Bjorn Helgaas
  2026-02-24 18:00 ` [PATCH v2] PCI: hotplug: Change return type of pci_hp_add_bridge() to void Majed Alkhaleefah
  0 siblings, 2 replies; 5+ messages in thread
From: Majed Alkhaleefah @ 2026-02-23  2:36 UTC (permalink / raw)
  To: Scott Murray, Bjorn Helgaas; +Cc: linux-pci, linux-kernel, Majed Alkhaleefah

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@gmail.com>
---
 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


^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH] PCI: cpcihp: Check pci_hp_add_bridge() return value
@ 2026-03-25 20:27 Brody England
  0 siblings, 0 replies; 5+ messages in thread
From: Brody England @ 2026-03-25 20:27 UTC (permalink / raw)
  To: scott; +Cc: bhelgaas, linux-pci, linux-kernel

cpci_configure_slot() ignores the return value of pci_hp_add_bridge()
and continues with resource assignment and device addition even if
bridge setup fails.

Check the return value, report the error, and abort slot configuration
if adding the bridge fails.

Compile-tested only.

Signed-off-by: Brody England <brodyengland3@gmail.com>
---
 drivers/pci/hotplug/cpci_hotplug_pci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
index 6c48066acb44..7ae02071e796 100644
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -269,8 +269,14 @@ 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)) {
+			ret = pci_hp_add_bridge(dev);
+			if (ret) {
+				err("Could not add hotplug bridge for slot %02x",
+				    slot->number);
+				goto out;
+			}
+		}
 	}
 
 	pci_assign_unassigned_bridge_resources(parent->self);
-- 
2.47.3


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

end of thread, other threads:[~2026-03-25 20:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-23  2:36 [PATCH] PCI: cpcihp: Check pci_hp_add_bridge() return value Majed Alkhaleefah
2026-02-23 17:26 ` Bjorn Helgaas
2026-02-24 18:00 ` [PATCH v2] PCI: hotplug: Change return type of pci_hp_add_bridge() to void Majed Alkhaleefah
2026-03-17 22:49   ` Majed Alkhaleefah
2026-03-25 20:27 [PATCH] PCI: cpcihp: Check pci_hp_add_bridge() return value Brody England

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®