All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fahmy Hassan <fahmymohammed@gmail.com>
To: helgaas@kernel.org, bhelgaas@google.com, scott@spiteful.org
Cc: fahmymohammed@gmail.com, kees@kernel.org,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: [PATCH v2 4/5] PCI: pciehp: Check pci_hp_add_bridge() return value
Date: Tue,  8 Sep 2026 20:22:25 -0600	[thread overview]
Message-ID: <20260909022227.620217-5-fahmymohammed@gmail.com> (raw)
In-Reply-To: <20260909022227.620217-1-fahmymohammed@gmail.com>

pciehp_configure_device() calls pci_hp_add_bridge() for each bridge on
the newly added slot without checking its return value.
pci_hp_add_bridge() already logs an error for one failure path (no
bus number available for the hot-added bridge), but returns silently
if the bridge's subordinate bus isn't created after scanning -- that
path goes completely unreported, and either way the caller currently
has no way to notice or react to the failure.

Log an error via the driver's existing ctrl_err() macro when
pci_hp_add_bridge() fails, identifying the device involved.

Signed-off-by: Fahmy Hassan <fahmymohammed@gmail.com>
---
 drivers/pci/hotplug/pciehp_pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c
index 65e50bee1a8c..cbdfde557f3b 100644
--- a/drivers/pci/hotplug/pciehp_pci.c
+++ b/drivers/pci/hotplug/pciehp_pci.c
@@ -59,7 +59,8 @@ int pciehp_configure_device(struct controller *ctrl)
 	}
 
 	for_each_pci_bridge(dev, parent)
-		pci_hp_add_bridge(dev);
+		if (pci_hp_add_bridge(dev))
+			ctrl_err(ctrl, "pci_hp_add_bridge(%s) failed\n", pci_name(dev));
 
 	pci_assign_unassigned_bridge_resources(bridge);
 	pcie_bus_configure_settings(parent);
-- 
2.53.0


  parent reply	other threads:[~2026-09-09  2:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09  1:30 [PATCH v1] PCI: cpqphp: Check pci_hp_add_bridge() return value Fahmy Hassan
2026-09-09  1:41 ` Bjorn Helgaas
2026-09-09  2:17   ` Fahmy Hassan
2026-09-09  2:22   ` [PATCH v2 0/5] PCI: hotplug: " Fahmy Hassan
2026-09-09  2:22     ` [PATCH v2 1/5] PCI: cpqphp: " Fahmy Hassan
2026-09-09  2:22     ` [PATCH v2 2/5] PCI: cpcihp: " Fahmy Hassan
2026-09-09  2:22     ` [PATCH v2 3/5] PCI: ibmphp: " Fahmy Hassan
2026-09-09  2:22     ` Fahmy Hassan [this message]
2026-09-09  6:42       ` [PATCH v2 4/5] PCI: pciehp: " Lukas Wunner
2026-09-09  2:22     ` [PATCH v2 5/5] PCI: shpchp: " Fahmy Hassan
2026-09-09  1:42 ` [PATCH v1] PCI: cpqphp: " sashiko-bot

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=20260909022227.620217-5-fahmymohammed@gmail.com \
    --to=fahmymohammed@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=kees@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.