Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
Cc: robh@kernel.org, imx@lists.linux.dev, linux-pci@vger.kernel.org,
	devicetree@vger.kernel.org, Frank.Li@kernel.org,
	conor+dt@kernel.org
Subject: Re: [PATCH V4 5/7] arm64: dts: imx8mq-evk: Move power supply properties to Root Port node
Date: Tue, 30 Jun 2026 06:20:53 +0000	[thread overview]
Message-ID: <20260630062054.2027C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260630060710.3294811-6-sherry.sun@oss.nxp.com>

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

New issues:
- [Critical] DT ABI breakage: Removing `vpcie-supply` and `vpcie3v3aux-supply` from the PCIe controller node breaks PCIe functionality on older kernels.

Pre-existing issues:
- [High] Resource and memory leak of regulators and `slot->supplies` array in `slot_pwrctrl_probe` error paths and driver teardown.
--

commit 331966289ddb574974fd80a80b3f1214ffc7055f
Author: Sherry Sun <sherry.sun@nxp.com>

arm64: dts: imx8mq-evk: Move power supply properties to Root Port node

This commit moves the vpcie-supply and vpcie3v3aux-supply properties from the
PCIe controller node to the Root Port child node. The change is intended to
support the new PCI pwrctrl framework.

> diff --git a/arch/arm64/boot/dts/freescale/imx8mq-evk.dts b/arch/arm64/boot/dts/freescale/imx8mq-evk.dts
> index e7d87ea81b697..541f6d5e9cefb 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mq-evk.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8mq-evk.dts
> @@ -403,8 +403,6 @@ &pcie1 {
>  		 <&pcie0_refclk>,
>  		 <&clk IMX8MQ_CLK_PCIE2_PHY>,
>  		 <&clk IMX8MQ_CLK_PCIE2_AUX>;
> -	vpcie-supply = <&reg_pcie1>;
> -	vpcie3v3aux-supply = <&reg_pcie1>;

[Severity: Critical]
Does removing these properties break DT ABI compatibility for older kernels?

If an older kernel lacks the new PCI pwrctrl framework, its pci-imx6.c driver
will look for vpcie-supply and vpcie3v3aux-supply in the parent PCIe controller
node.

Without pci-pwrctrl to enable the child node's supplies, the regulators might
never be turned on, causing PCIe devices to fail probing.

>  	vph-supply = <&vgen5_reg>;
>  	supports-clkreq;
>  	status = "okay";
> @@ -422,6 +420,8 @@ &pcie1_ep {
>  
>  &pcie1_port0 {
>  	reset-gpios = <&gpio5 12 GPIO_ACTIVE_LOW>;
> +	vpcie3v3-supply = <&reg_pcie1>;
> +	vpcie3v3aux-supply = <&reg_pcie1>;
>  };

[ ... ]

[Severity: High]
This is a pre-existing issue, but while reviewing the PCI pwrctrl framework
that this DT change supports, I noticed a potential resource leak in the
probing path.

In drivers/pci/pwrctrl/generic.c:slot_pwrctrl_probe():

        slot->clk = devm_clk_get_optional(dev, NULL);
        if (IS_ERR(slot->clk))
                return dev_err_probe(dev, PTR_ERR(slot->clk),
                                     "Failed to enable slot clock\n");

If devm_clk_get_optional() fails (e.g., returns -EPROBE_DEFER), does this
return path leak the slot->supplies array allocated by
of_regulator_bulk_get_all(), as well as the regulator references?

Since devm_add_action_or_reset() has not yet been registered at this point, it
appears the cleanup is skipped entirely on this failure path.

Additionally, looking at the driver teardown path:

drivers/pci/pwrctrl/generic.c:devm_slot_pwrctrl_release() {
        struct slot_pwrctrl *slot = data;

        regulator_bulk_free(slot->num_supplies, slot->supplies);
}

Does regulator_bulk_free() actually free the dynamically allocated array
itself, or does it only drop the regulator references, leaving the
slot->supplies array memory permanently leaked on unbind?

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

  reply	other threads:[~2026-06-30  6:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30  6:07 [PATCH V4 0/7] PCI: imx6: Integrate pwrctrl API and update device trees Sherry Sun (OSS)
2026-06-30  6:07 ` [PATCH V4 1/7] arm: dts: imx6qdl-sabresd: Move power supply property to Root Port node Sherry Sun (OSS)
2026-06-30  6:27   ` sashiko-bot
2026-06-30  8:29     ` Sherry Sun
2026-06-30  6:07 ` [PATCH V4 2/7] arm: dts: imx6sx-sdb: " Sherry Sun (OSS)
2026-06-30  6:25   ` sashiko-bot
2026-06-30  8:29     ` Sherry Sun
2026-06-30  6:07 ` [PATCH V4 3/7] arm64: dts: imx8mm-evk: " Sherry Sun (OSS)
2026-06-30  6:12   ` sashiko-bot
2026-06-30  6:07 ` [PATCH V4 4/7] arm64: dts: imx8mp-evk: Move power supply properties " Sherry Sun (OSS)
2026-06-30  6:19   ` sashiko-bot
2026-06-30  8:34     ` Sherry Sun
2026-06-30  6:07 ` [PATCH V4 5/7] arm64: dts: imx8mq-evk: " Sherry Sun (OSS)
2026-06-30  6:20   ` sashiko-bot [this message]
2026-06-30  8:40     ` Sherry Sun
2026-06-30  6:07 ` [PATCH V4 6/7] arm64: dts: imx8dxl/qm/qxp: " Sherry Sun (OSS)
2026-06-30  6:24   ` sashiko-bot
2026-06-30  8:38     ` Sherry Sun
2026-06-30  6:07 ` [PATCH V4 7/7] arm64: dts: imx95: " Sherry Sun (OSS)
2026-06-30  6:23   ` sashiko-bot
2026-06-30  8:44     ` Sherry Sun
2026-06-30 15:31 ` [PATCH V4 0/7] PCI: imx6: Integrate pwrctrl API and update device trees Frank.Li
2026-06-30 15:52   ` Frank Li
2026-07-01  8:44     ` Sherry Sun

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=20260630062054.2027C1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.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