From: sashiko-bot@kernel.org
To: "WenTao Liang" <vulab@iscas.ac.cn>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH] fix: PCI: dra7xx: dra7xx_pcie_probe: fix missing device_link_del on phy error paths
Date: Fri, 26 Jun 2026 15:57:14 +0000 [thread overview]
Message-ID: <20260626155715.01EAC1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260626154809.53770-1-vulab@iscas.ac.cn>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Double cleanup of PHY resources on error path.
- [Low] Compilation error due to undefined label `err_link`.
--
commit 51479d1472b27aa065c936360d150e8e275d37b6
Author: WenTao Liang <vulab@iscas.ac.cn>
fix: PCI: dra7xx: dra7xx_pcie_probe: fix missing device_link_del on phy error paths
This commit addresses a device link leak in the phy error paths of
dra7xx_pcie_probe(). It changes the error paths to jump to the err_link
label to properly call device_link_del() for each link. It also updates
the phy enable error paths.
> diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
> index 3fc889944f021..c54d68cf0e412 100644
> --- a/drivers/pci/controller/dwc/pci-dra7xx.c
> +++ b/drivers/pci/controller/dwc/pci-dra7xx.c
[ ... ]
> @@ -766,7 +768,8 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
> ret = dra7xx_pcie_enable_phy(dra7xx);
> if (ret) {
> dev_err(dev, "failed to enable phy\n");
> - return ret;
> + dra7xx_pcie_disable_phy(dra7xx);
> + goto err_link;
> }
[Severity: High]
Does this cause a double cleanup of the PHY resources?
When dra7xx_pcie_enable_phy() fails, it already cleans up any partially
enabled PHYs internally before returning. Calling dra7xx_pcie_disable_phy()
here will repeat the cleanup on the same PHYs, which could lead to
unbalanced reference counts in the PHY framework (underflowing power_count
and init_count).
[ ... ]
> @@ -909,7 +912,8 @@ static int dra7xx_pcie_resume_noirq(struct device *dev)
> ret = dra7xx_pcie_enable_phy(dra7xx);
> if (ret) {
> dev_err(dev, "failed to enable phy\n");
> - return ret;
> + dra7xx_pcie_disable_phy(dra7xx);
[Severity: High]
Similar to the probe function, could this cause a double cleanup of the
PHY resources since dra7xx_pcie_enable_phy() handles its own cleanup on
failure?
> + goto err_link;
[Severity: Low]
Does this label exist in this function?
It appears that the err_link label is not defined anywhere in
dra7xx_pcie_resume_noirq(), which will result in a compilation error.
> }
>
> return 0;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260626154809.53770-1-vulab@iscas.ac.cn?part=1
next prev parent reply other threads:[~2026-06-26 15:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-26 15:48 [PATCH] fix: PCI: dra7xx: dra7xx_pcie_probe: fix missing device_link_del on phy error paths WenTao Liang
2026-06-26 15:57 ` sashiko-bot [this message]
2026-06-28 4:01 ` WenTao Liang
2026-08-14 20:00 ` kernel test robot
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=20260626155715.01EAC1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vulab@iscas.ac.cn \
/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.