From: Bjorn Helgaas <helgaas@kernel.org>
To: Majed Alkhaleefah <majedalkhaleefah@gmail.com>
Cc: Scott Murray <scott@spiteful.org>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: cpcihp: Check pci_hp_add_bridge() return value
Date: Mon, 23 Feb 2026 11:26:40 -0600 [thread overview]
Message-ID: <20260223172640.GA3697753@bhelgaas> (raw)
In-Reply-To: <20260223023645.344137-2-majedalkhaleefah@gmail.com>
On Mon, Feb 23, 2026 at 02:36:46AM +0000, Majed Alkhaleefah wrote:
> 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.
This sentence could just be dropped and the item removed from the list
in the same patch.
> 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);
There are five callers of pci_hp_add_bridge(), and none of them checks
the return value, so I'm not sure it's worth just changing this one.
I suspect something in the pci_hp_add_bridge() path would already log
a message in the event of a failure. If that's the case, I doubt it's
worth adding another message here (and maybe pci_hp_add_bridge()
should just be made a void function). If we *do* need a message here,
I would want to update all the callers similarly.
> + }
> + }
> }
>
> pci_assign_unassigned_bridge_resources(parent->self);
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-02-23 17:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 2:36 Majed Alkhaleefah
2026-02-23 17:26 ` Bjorn Helgaas [this message]
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
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=20260223172640.GA3697753@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=majedalkhaleefah@gmail.com \
--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®