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