From: sashiko-bot@kernel.org
To: "Christian Marangi" <ansuelsmth@gmail.com>
Cc: olteanv@gmail.com, devicetree@vger.kernel.org, vkoul@kernel.org,
neil.armstrong@linaro.org, linux-phy@lists.infradead.org,
conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 2/2] phy: airoha: add support for AN7583 Gen3 PCIe PHY driver
Date: Tue, 01 Sep 2026 13:08:59 +0000 [thread overview]
Message-ID: <20260901130900.518CE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901125819.20378-3-ansuelsmth@gmail.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Incorrect teardown order and potential resource leak in an7583_pcie_phy_exit().
- [Medium] Calling phy_init() and phy_exit() on a child PHY from within the parent's init/exit callbacks triggers a lockdep recursive locking warning.
- [Low] Missing 'select REGMAP_MMIO' causes build failures.
--
commit d7a329b5d2d570ebb31f2d95a8c4c781915cf2bd
Author: Christian Marangi <ansuelsmth@gmail.com>
phy: airoha: add support for AN7583 Gen3 PCIe PHY driver
This commit adds support for the AN7583 PCIe PHY driver. It introduces the
initialization callback for the PCIe Gen3 port present on the Airoha AN7583
SoC, which requires a different calibration process and register setup
compared to the EN7581.
> diff --git a/drivers/phy/airoha/Kconfig b/drivers/phy/airoha/Kconfig
> new file mode 100644
> index 0000000000000..55fd20f29da65
> --- /dev/null
> +++ b/drivers/phy/airoha/Kconfig
> @@ -0,0 +1,13 @@
[ ... ]
> +config PHY_AIROHA_AN7583_PCIE
> + tristate "Airoha AN7583 PCIe-PHY Driver"
> + depends on ARCH_AIROHA || COMPILE_TEST
> + depends on OF
> + select GENERIC_PHY
[Severity: Low]
Since the driver uses devm_regmap_init_mmio(), should this Kconfig
entry also select REGMAP_MMIO to prevent build failures? If this driver
is built with COMPILE_TEST on architectures that do not select REGMAP_MMIO
by default, it will cause an undefined reference link error for
__devm_regmap_init_mmio_clk.
> diff --git a/drivers/phy/airoha/phy-an7583-pcie.c b/drivers/phy/airoha/phy-an7583-pcie.c
> new file mode 100644
> index 0000000000000..8aaca3f50713c
> --- /dev/null
> +++ b/drivers/phy/airoha/phy-an7583-pcie.c
[ ... ]
> +static int an7583_pcie_phy_init(struct phy *phy)
> +{
> + struct an7583_pcie_phy *pcie_phy = phy_get_drvdata(phy);
> + u32 val;
> + int ret;
[ ... ]
> + regmap_set_bits(pcie_phy->g3_pma, REG_SS_DA_XPON_PWDB_0,
> + G3_PMA_DA_XPON_CDR_PR_PWDB);
> +
> + usleep_range(100, 200);
> +
> + ret = phy_init(pcie_phy->qp_phy);
[Severity: Medium]
Will calling phy_init() on the child PHY from within the parent's init
callback trigger a lockdep recursive locking warning? The PHY core already
holds the parent's phy->mutex when executing this callback. Since all PHY
mutexes are initialized to the same lock class in phy_create(), acquiring
the child's mutex here is seen by lockdep as recursive locking on the
same class, which will emit a warning splat and disable lockdep.
> + if (ret) {
> + an7583_pcie_phy_deinit(pcie_phy);
> +
> + return dev_err_probe(pcie_phy->dev, ret, "failed to initialize QP phy\n");
> + }
> +
> + /* Wait for the PCIe PHY to complete initialization before returning */
> + msleep(PHY_HW_INIT_TIME_MS);
> +
> + return 0;
> +}
> +
> +static int an7583_pcie_phy_exit(struct phy *phy)
> +{
> + struct an7583_pcie_phy *pcie_phy = phy_get_drvdata(phy);
> + int ret;
> +
> + ret = an7583_pcie_phy_deinit(pcie_phy);
> + if (ret)
> + return ret;
> +
> + return phy_exit(pcie_phy->qp_phy);
[Severity: High]
Does this teardown order safely handle the child PHY? This sequence shuts
down the parent PHY hardware and clocks before calling phy_exit() on the
child PHY. If the child PHY attempts to access parent-provided clocks or
registers during its exit routine, could this cause a bus hang or system
crash?
Additionally, if an7583_pcie_phy_deinit() returns an error, the child PHY
resource will be leaked due to the early return. Should phy_exit() be called
first to exactly reverse the initialization order?
[Severity: Medium]
Similar to the init path, will calling phy_exit() on the child PHY from
within the parent's exit callback trigger a lockdep recursive locking warning
on phy->mutex?
> +}
> +
> +static const struct phy_ops an7583_pcie_phy_ops = {
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260901125819.20378-1-ansuelsmth@gmail.com?part=2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
prev parent reply other threads:[~2026-09-01 13:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 12:58 [PATCH v3 0/2] phy: airoha: add support for AN7583 PCIe PHY driver Christian Marangi
2026-09-01 12:58 ` [PATCH v3 1/2] dt-bindings: phy: airoha: Document support for AN7583 Gen3 PCIe PHY Christian Marangi
2026-09-01 12:58 ` [PATCH v3 2/2] phy: airoha: add support for AN7583 Gen3 PCIe PHY driver Christian Marangi
2026-09-01 13:08 ` sashiko-bot [this message]
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=20260901130900.518CE1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ansuelsmth@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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