From: sashiko-bot@kernel.org
To: "Sreeraj S Kurup" <sreekuttan2156239@gmail.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v8] PCI: exynos: Handle PCIe PHY initialization errors
Date: Sat, 31 Oct 2026 07:46:39 +0000 [thread overview]
Message-ID: <sashiko-outbox-191809@kernel.org> (raw)
In-Reply-To: <20261031073548.3916-1-sreekuttan2156239@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] PCI: exynos: regulator refcount leak in exynos_pcie_suspend_noirq()
--
commit b886839653b4a8156d97c162a00a5d1ee22e14d1
Author: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
PCI: exynos: Handle PCIe PHY initialization errors
This commit checks return values from PHY initialization and power-on calls,
and tracks PHY and regulator state across probe, remove, suspend, and resume
to ensure proper error handling and cleanup.
> diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c
> index e3c05ade381bb..45163b1dad81d 100644
> --- a/drivers/pci/controller/dwc/pci-exynos.c
> +++ b/drivers/pci/controller/dwc/pci-exynos.c
[ ... ]
> @@ -332,22 +388,42 @@ static int exynos_pcie_probe(struct platform_device *pdev)
[ ... ]
> static int exynos_pcie_suspend_noirq(struct device *dev)
> {
> struct exynos_pcie *ep = dev_get_drvdata(dev);
> + int ret;
>
> exynos_pcie_assert_core_reset(ep);
> - phy_power_off(ep->phy);
> - phy_exit(ep->phy);
> - regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies);
> +
> + ret = exynos_pcie_phy_exit(ep);
> + if (ret)
> + dev_err(dev, "failed to exit PCIe PHY during suspend: %d\n", ret);
> +
> + if (ep->supplies_enabled) {
> + ret = regulator_bulk_disable(ARRAY_SIZE(ep->supplies), ep->supplies);
> + if (ret)
> + dev_err(dev, "failed to disable regulators during suspend: %d\n", ret);
> +
> + ep->supplies_enabled = false;
> + }
[Severity: Medium]
In exynos_pcie_suspend_noirq(), if regulator_bulk_disable() fails, its error
recovery path re-enables any supplies that were already disabled during the
call and leaves ep->supplies enabled.
Unlike the error paths in exynos_pcie_probe(), exynos_pcie_remove(), and
exynos_pcie_resume_noirq(), ep->supplies_enabled is unconditionally set to
false here even when regulator_bulk_disable() returns an error.
When exynos_pcie_resume_noirq() later runs:
if (!ep->supplies_enabled) {
ret = regulator_bulk_enable(ARRAY_SIZE(ep->supplies), ep->supplies);
if (ret)
return ret;
ep->supplies_enabled = true;
}
won't this call regulator_bulk_enable() a second time on already-enabled
supplies and leak a regulator enable reference count (or skip
regulator_bulk_disable() if the driver is removed first)? Should setting
ep->supplies_enabled = false be placed in an else branch as in the other
functions?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261031073548.3916-1-sreekuttan2156239@gmail.com?part=1
next prev parent reply other threads:[~2026-10-31 7:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 13:10 [PATCH] PCI: exynos: Handle PHY initialization errors Sreeraj S Kurup
2026-10-29 13:17 ` sashiko-bot
2026-10-29 17:54 ` [PATCH v2] PCI: exynos: Handle PCIe " Sreeraj S Kurup
2026-10-29 18:07 ` sashiko-bot
2026-10-30 15:17 ` [PATCH v3] " Sreeraj S Kurup
2026-10-30 15:40 ` sashiko-bot
2026-10-30 16:36 ` [PATCH v4] " Sreeraj S Kurup
2026-10-30 16:48 ` sashiko-bot
2026-10-30 17:23 ` [PATCH v5] " Sreeraj S Kurup
2026-10-30 17:38 ` sashiko-bot
2026-10-30 18:09 ` [PATCH v6] " Sreeraj S Kurup
2026-10-30 18:25 ` sashiko-bot
2026-10-31 7:01 ` [PATCH v7] " Sreeraj S Kurup
2026-10-31 7:14 ` sashiko-bot
2026-10-31 7:35 ` [PATCH v8] " Sreeraj S Kurup
2026-10-31 7:46 ` sashiko-bot [this message]
2026-10-31 9:49 ` [PATCH v9] " Sreeraj S Kurup
2026-10-31 10:03 ` sashiko-bot
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-191809@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sreekuttan2156239@gmail.com \
/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