Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
Cc: linux-pci@vger.kernel.org, Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH 1/2] PCI: host-generic: Simplify return value handling in pci_host_common_parse_port(s)
Date: Fri, 22 May 2026 04:01:28 +0000	[thread overview]
Message-ID: <20260522040130.66CC51F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260522034344.1147775-2-sherry.sun@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Changing the return value of `pci_host_common_parse_ports()` to 0 instead of `-ENODEV` silently breaks the legacy device tree fallback logic in `imx_pcie_host_init()`.
--

commit 8c94bf783e4da5a465164e0d82606c1c5b6786e2
Author: Sherry Sun <sherry.sun@nxp.com>

PCI: host-generic: Simplify return value handling in pci_host_common_parse_port(s)

This commit simplifies pci_host_common_parse_port() by removing the
RC-level binding check, leaving it as a policy decision for the caller.
It also changes pci_host_common_parse_ports() to return 0 when no ports
are found, instead of -ENODEV.

> diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
> index 67455caaf9e68..7ce5a939e3d94 100644
> --- a/drivers/pci/controller/pci-host-common.c
> +++ b/drivers/pci/controller/pci-host-common.c
[ ... ]
> @@ -158,13 +141,11 @@ static int pci_host_common_parse_port(struct device *dev,
>   * Iterate through child nodes of the host bridge and parse Root Port
>   * properties (currently only reset GPIOs).
>   *
> - * Return: 0 on success, -ENODEV if no ports found or PERST# found in RC
> - * node (legacy binding should be used), Other negative error codes on
> - * failure.
> + * Return: 0 on success, negative error codes on failure.
>   */
>  int pci_host_common_parse_ports(struct device *dev, struct pci_host_bridge *bridge)
>  {
> -	int ret = -ENODEV;
> +	int ret = 0;
>  
>  	for_each_available_child_of_node_scoped(dev->of_node, of_port) {
>  		if (!of_node_is_type(of_port, "pci"))
[ ... ]
> @@ -174,8 +155,8 @@ int pci_host_common_parse_ports(struct device *dev, struct pci_host_bridge *brid
>  			goto err_cleanup;
>  	}
>  
> -	if (ret)
> -		return ret;
> +	if (list_empty(&bridge->ports))
> +		return 0;

[Severity: High]
Does changing this return value to 0 break the legacy device tree fallback
logic in imx_pcie_host_init()?

Before this patch, pci_host_common_parse_ports() returned -ENODEV if no
ports were found or if a legacy reset-gpios property was detected in the
Root Complex node. The caller imx_pcie_host_init() explicitly relies on
ret == -ENODEV to safely fall back to imx_pcie_parse_legacy_binding().

By removing the RC-level check and returning 0 on empty lists,
imx_pcie_host_init() will see success instead of an error, completely
bypassing the legacy binding fallback. This would cause the PERST# GPIO
to never be parsed or requested, leading to device initialization failure
on i.MX6 platforms using older legacy device tree bindings.

I see that this issue is fixed later in the series by a subsequent commit
("PCI: imx6: Add imx_pcie_perst_found() to inspect the parsed result").
However, kernel rules require each intermediate patch to be self-contained
without introducing regressions. Does this intermediate state break
bisectability for i.MX6 platforms?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260522034344.1147775-1-sherry.sun@oss.nxp.com?part=1

  reply	other threads:[~2026-05-22  4:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22  3:43 [PATCH 0/2] PCI: imx6: Improve PERST# fallback logic Sherry Sun (OSS)
2026-05-22  3:43 ` [PATCH 1/2] PCI: host-generic: Simplify return value handling in pci_host_common_parse_port(s) Sherry Sun (OSS)
2026-05-22  4:01   ` sashiko-bot [this message]
2026-05-22  6:05   ` Hongxing Zhu
2026-05-22  6:20     ` Sherry Sun
2026-05-22  3:43 ` [PATCH 2/2] PCI: imx6: Add imx_pcie_perst_found() to inspect the parsed result Sherry Sun (OSS)
2026-05-22  6:05   ` Hongxing Zhu

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=20260522040130.66CC51F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox