All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: hongxing.zhu@oss.nxp.com
Cc: Frank.Li@kernel.org, imx@lists.linux.dev, linux-pci@vger.kernel.org
Subject: Re: [PATCH v1] PCI: imx6: Move clock enable after core reset assertion
Date: Thu, 13 Aug 2026 08:36:41 +0000	[thread overview]
Message-ID: <20260813083641.C1EBE1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260813082900.270003-1-hongxing.zhu@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The return value of imx_pcie_host_init() is ignored in imx_add_pcie_ep(), leading to a kernel crash if hardware initialization fails.
--

--- Patch [1]: [PATCH v1] PCI: imx6: Move clock enable after core reset assertion ---
commit 6d9f9eb5750531f447a5eaee6a038ee84ba72010
Author: Richard Zhu <hongxing.zhu@nxp.com>

PCI: imx6: Move clock enable after core reset assertion

This patch reverts a sequence change by moving clock enablement after
asserting core reset and configuring the controller type. This restores
correct initialization on i.MX6Q Apalis platforms where PCI device
initialization was failing.

Link: https://lore.kernel.org/all/bl7i3obu2clzsgeoct2a4mtfhv6typcjdqmgneropf3hpgwve6@n2m5uhlduw57/T/#u
Link: https://lore.kernel.org/all/t65y5d54axtksbfs7r4olcefqhwm6m4dz3njgnrnf7fcotj74i@o7avoznlafbj/

> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 39790e66b98dc..f7a2eb257c169 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c

[ ... ]

> @@ -1415,6 +1409,12 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp)
>  
>  	imx_pcie_configure_type(imx_pcie);
>  
> +	ret = imx_pcie_clk_enable(imx_pcie);
> +	if (ret) {
> +		dev_err(dev, "unable to enable pcie clocks: %d\n", ret);
> +		goto err_pwrctrl_power_off;
> +	}
> +
[Severity: High]
This is a pre-existing issue, but is it safe for imx_add_pcie_ep() to ignore
the return value of imx_pcie_host_init()?

Looking at imx_add_pcie_ep(), it calls imx_pcie_host_init() and immediately
proceeds without checking if it succeeded:

drivers/pci/controller/dwc/pci-imx6.c:imx_add_pcie_ep() {
    ...
	imx_pcie_host_init(pp);
	ep = &pci->ep;
	ep->ops = &pcie_ep_ops;
    ...
	ret = dw_pcie_ep_init(ep);
    ...
}

If imx_pcie_host_init() fails here (for example, if imx_pcie_clk_enable()
returns an error), it cleans up its resources and returns an error code with
clocks disabled.

Execution would then continue into dw_pcie_ep_init(), which attempts
hardware register accesses. On i.MX hardware, accessing PCIe registers with
disabled clocks triggers a synchronous bus error (SError), resulting in a
kernel panic.

Could imx_add_pcie_ep() be updated to check the return value of
imx_pcie_host_init() and handle the failure gracefully?

>  	if (imx_pcie->phy) {
>  		ret = phy_init(imx_pcie->phy);
>  		if (ret) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260813082900.270003-1-hongxing.zhu@oss.nxp.com?part=1

  reply	other threads:[~2026-08-13  8:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  8:29 [PATCH v1] PCI: imx6: Move clock enable after core reset assertion hongxing.zhu
2026-08-13  8:36 ` sashiko-bot [this message]
2026-08-13  8:39 ` Francesco Dolcini
2026-08-13  8:47   ` Hongxing Zhu (OSS)

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=20260813083641.C1EBE1F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=hongxing.zhu@oss.nxp.com \
    --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 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.