Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Angel J" <iamanaws@httpd.dev>
Cc: devicetree@vger.kernel.org, robh@kernel.org,
	linux-pci@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH] PCI: of: Skip dynamic nodes for bridges without a subordinate bus
Date: Fri, 11 Sep 2026 23:13:00 +0000	[thread overview]
Message-ID: <20260911231301.6AEDA1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260911230420.26244-1-iamanaws@httpd.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The fix for the NULL pointer dereference is an incorrect workaround that completely skips creating the dynamic OF node for the bridge device.
--

commit 876df8df861d1c7910e8724db8a082e07c66b879
Author: Angel J <iamanaws@httpd.dev>

PCI: of: Skip dynamic nodes for bridges without a subordinate bus

This commit adds an early return in of_pci_make_dev_node() for bridge
devices lacking a subordinate bus to prevent a boot hang on certain systems.

> diff --git a/drivers/pci/of.c b/drivers/pci/of.c
> index a51dff91b196d..971c79c2a77da 100644
> --- a/drivers/pci/of.c
> +++ b/drivers/pci/of.c
> @@ -765,6 +765,10 @@ void of_pci_make_dev_node(struct pci_dev *pdev)
>  	if (!ppnode)
>  		return;
>  
> +	/* Bridge properties require a subordinate bus. */
> +	if (pci_is_bridge(pdev) && !pdev->subordinate)
> +		return;
> +

[Severity: Medium]
Does completely skipping the OF node creation for these bridges cause
unintended side effects?

Since endpoint devices also lack subordinate buses but correctly get OF nodes,
wouldn't it be better to let the node creation proceed for the bridge, and
instead skip only the bus-range and interrupt-map properties?

The actual null pointer dereference appears to happen in
of_pci_add_properties() when handling those specific properties:

drivers/pci/of_property.c:of_pci_add_properties() {
    ...
    ret = of_pci_prop_bus_range(pdev, ocs, np);
    if (ret)
        return ret;

    ret = of_pci_prop_intr_map(pdev, ocs, np);
    if (ret)
        return ret;
    ...
}

Could the subordinate check be moved there instead, so the bridge still
receives its basic OF node configurations like the reg property?

>  	if (pci_is_bridge(pdev))
>  		pci_type = "pci";
>  	else

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260911230420.26244-1-iamanaws@httpd.dev?part=1

  reply	other threads:[~2026-09-11 23:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-23  2:14 [REGRESSION] PCI: Dynamic OF node creation hangs on invalid bridge configuration Angel J
2026-09-01  0:59 ` Angel J
2026-09-01  6:07   ` Thorsten Leemhuis
2026-09-03 23:17 ` Bjorn Helgaas
2026-09-04  8:57   ` Herve Codina
2026-09-09 11:27     ` Andrea della Porta
2026-09-11 23:01 ` Angel J
2026-09-11 23:04   ` [PATCH] PCI: of: Skip dynamic nodes for bridges without a subordinate bus Angel J
2026-09-11 23:13     ` sashiko-bot [this message]
2026-09-12  4:31     ` [PATCH v2] PCI: of_property: Omit bus properties " Angel J
2026-09-12  4:42       ` 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=20260911231301.6AEDA1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=iamanaws@httpd.dev \
    --cc=linux-pci@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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