From: sashiko-bot@kernel.org
To: "Alex Elder" <elder@riscstar.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v7 4/4] PCI: of: introduce of_pci_verify_node()
Date: Thu, 05 Nov 2026 16:30:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-199499@kernel.org> (raw)
In-Reply-To: <20261105153801.435566-5-elder@riscstar.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] PCI: of: of_pci_verify_node() defined outside CONFIG_PCI guard
--
commit 3ae9eba1c84ba51b7f2ee89655e65140eb2d2cd0
Author: Alex Elder <elder@riscstar.com>
PCI: of: introduce of_pci_verify_node()
This commit introduces of_pci_verify_node() and calls it from
pci_bus_add_device() to check that devicetree nodes for PCI bridges have a
device_type property of "pci" or "pciex", and that PCI endpoint nodes do not.
> diff --git a/drivers/pci/of.c b/drivers/pci/of.c
> index a51dff91b196d..5a040ed836744 100644
> --- a/drivers/pci/of.c
> +++ b/drivers/pci/of.c
> @@ -1085,3 +1085,35 @@ int of_pci_get_equalization_presets(struct device *dev,
> return 0;
> }
> EXPORT_SYMBOL_GPL(of_pci_get_equalization_presets);
> +
> +/**
> + * of_pci_verify_node - Sanity check some PCI device node properties
> + * @pdev: The PCI device whose device node is checked
> + *
> + * PCI enumeration authoritatively discovers what we need to know about
> + * a PCI device. A devicetree-based platform will represent a PCI root
> + * bridge with a node, but otherwise devicetree doesn't typically include
> + * many PCI nodes. Where such nodes do exist, experience has shown that
> + * the "device_type" property is sometimes wrong, so warn about that.
> + */
> +void of_pci_verify_node(struct pci_dev *pdev)
> +{
> + struct device_node *np = pci_device_to_OF_node(pdev);
> + bool device_is_bridge;
> + bool device_type_pci;
> +
> + /* Nothing to check if there's no pre-existing devicetree node */
> + if (!np)
> + return;
> +
> + device_is_bridge = pci_is_bridge(pdev);
> + device_type_pci = of_node_is_type(np, "pci") ||
> + of_node_is_type(np, "pciex");
> +
> + /* Bridges should have device type "pci"; endpoints should not */
> + if (device_is_bridge == device_type_pci)
> + return;
> +
> + dev_err(&pdev->dev, "PCI %s have \"pci\" device_type property\n",
> + device_is_bridge ? "bridge should" : "endpoint should not");
> +}
[Severity: Low]
Should of_pci_verify_node() be placed inside the #ifdef CONFIG_PCI block in
drivers/pci/of.c rather than at the end of the file?
drivers/pci/of.o is built whenever CONFIG_OF is enabled so that PCI endpoint
controller drivers can use the exported devicetree helpers defined after
the #endif /* CONFIG_PCI */ guard:
drivers/pci/of.c:
bool of_pci_supply_present(struct device_node *np)
{
...
}
EXPORT_SYMBOL_GPL(of_pci_supply_present);
#endif /* CONFIG_PCI */
int of_pci_get_max_link_speed(struct device_node *node)
Since of_pci_verify_node() is only called from pci_bus_add_device() in
drivers/pci/bus.c (which is only built when CONFIG_PCI is enabled), defining
it after #endif /* CONFIG_PCI */ causes it to be compiled as unused code when
CONFIG_OF=y and CONFIG_PCI=n.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261105153801.435566-1-elder@riscstar.com?part=4
prev parent reply other threads:[~2026-11-05 16:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 15:37 [PATCH v7 0/4] PCI: of: warn on bogus device_type property Alex Elder
2026-11-05 15:37 ` [PATCH v7 1/4] PCI: of: avoid allocations in of_pci_prop_compatible() Alex Elder
2026-11-05 16:05 ` sashiko-bot
2026-11-05 15:37 ` [PATCH v7 2/4] PCI: of: drop the reg_num argument to of_pci_set_address() Alex Elder
2026-11-05 16:08 ` sashiko-bot
2026-11-05 15:38 ` [PATCH v7 3/4] PCI: of: don't zero flags in of_pci_get_addr_flags() Alex Elder
2026-11-05 16:13 ` sashiko-bot
2026-11-05 15:38 ` [PATCH v7 4/4] PCI: of: introduce of_pci_verify_node() Alex Elder
2026-11-05 16:30 ` sashiko-bot [this message]
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=sashiko-outbox-199499@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=elder@riscstar.com \
--cc=linux-pci@vger.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 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.