mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brody England <brodyengland3@gmail.com>
To: scott@spiteful.org
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] PCI: cpcihp: Check pci_hp_add_bridge() return value
Date: Wed, 25 Mar 2026 13:27:20 -0700	[thread overview]
Message-ID: <20260325202720.389400-1-brodyengland3@gmail.com> (raw)

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


             reply	other threads:[~2026-03-25 20:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25 20:27 Brody England [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-02-23  2:36 Majed Alkhaleefah
2026-02-23 17:26 ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260325202720.389400-1-brodyengland3@gmail.com \
    --to=brodyengland3@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=scott@spiteful.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®