Skip to contentSkip to conversation

PCI: cpcihp: Check pci_hp_add_bridge() return value

PATCH New Brody England 1 participant 1 message Mar 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: cpcihp: Check pci_hp_add_bridge() return value

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.

---
 drivers/pci/hotplug/cpci_hotplug_pci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/pci/hotplug/cpci_hotplug_pci.c +8 -2
index 6c48066acb44..7ae02071e796 100644
@@ -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);
Signature · 1 line
2.47.3