From: sashiko-bot@kernel.org
To: "George Moussalem via B4 Relay"
<devnull+george.moussalem.outlook.com@kernel.org>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/4] dt-bindings: net: qca,ar803x: Add clocks property for IPQ5018 PHY
Date: Wed, 03 Jun 2026 06:50:59 +0000 [thread overview]
Message-ID: <20260603065059.928F21F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260602-ipq5018-gephy-clocks-v2-2-65a1f1d881f3@outlook.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The PHY's link_change_notify callback naively toggles clocks based on link state without tracking its own enable state, leading to severe clock leaks and unbalanced disables.
--
commit b2bbbd0f6e2e237442a168520c225e85c25f2d4a
Author: George Moussalem <george.moussalem@outlook.com>
net: phy: at803x: add RX and TX clock management for IPQ5018 PHY
Acquire and enable the RX and TX clocks for the IPQ5018 PHY. These clocks
are required for the PHY's datapath to function correctly. In addition,
gate the clocks upon link state changes for improved power management.
> diff --git a/drivers/net/phy/qcom/at803x.c b/drivers/net/phy/qcom/at803x.c
> index 63726cf98cd42..b7361a14220d8 100644
> --- a/drivers/net/phy/qcom/at803x.c
> +++ b/drivers/net/phy/qcom/at803x.c
[ ... ]
> @@ -1062,6 +1065,16 @@ static int ipq5018_config_init(struct phy_device *phydev)
>
> static void ipq5018_link_change_notify(struct phy_device *phydev)
> {
> + struct ipq5018_priv *priv = phydev->priv;
> +
> + if (phydev->link) {
> + clk_enable(priv->rx_clk);
> + clk_enable(priv->tx_clk);
> + } else {
> + clk_disable(priv->rx_clk);
> + clk_disable(priv->tx_clk);
> + }
> +
[Severity: High]
Can this logic in ipq5018_link_change_notify() lead to unbalanced clock
enable and disable operations?
The callback is executed by phy_process_state_change() for every change in
phydev->state.
If an interface is brought down manually, phy_stop() transitions the state
to PHY_HALTED and calls phy_process_state_change(). At this exact moment,
phydev->link has not been updated yet and remains 1 if the interface was
running. Consequently, this callback executes a duplicate clk_enable() on an
already enabled clock, incrementing the enable count to 2 and causing a
permanent clock leak.
Conversely, if the interface is brought down when the link is already down
(meaning phydev->link == 0 and the clock was already disabled during the
PHY_UP to PHY_NOLINK transition), phy_process_state_change() triggers the
callback again. The callback reads phydev->link == 0 and executes a
duplicate clk_disable() on an already disabled clock.
This triggers an unbalanced clock disable kernel warning and underflows the
clock's enable count, which can corrupt the system's clock tree and block
power state transitions.
Could we track the clock's enable state within struct ipq5018_priv to prevent
these duplicate operations during state machine transitions?
> /*
> * Reset the FIFO buffer upon link disconnects to clear any residual data
> * which may cause issues with the FIFO which it cannot recover from.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260602-ipq5018-gephy-clocks-v2-0-65a1f1d881f3@outlook.com?part=2
next prev parent reply other threads:[~2026-06-03 6:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 6:50 [PATCH v2 0/4] IPQ5018: Add and enable GEPHY RX and TX clocks George Moussalem via B4 Relay
2026-06-02 6:50 ` [PATCH v2 1/4] dt-bindings: net: ethernet-phy: move clocks property to invidivual PHY bindings George Moussalem via B4 Relay
2026-06-02 16:34 ` Conor Dooley
2026-06-03 6:42 ` George Moussalem
2026-06-03 6:50 ` sashiko-bot
2026-06-02 6:50 ` [PATCH v2 2/4] dt-bindings: net: qca,ar803x: Add clocks property for IPQ5018 PHY George Moussalem via B4 Relay
2026-06-02 16:29 ` Conor Dooley
2026-06-03 6:50 ` sashiko-bot [this message]
2026-06-02 6:50 ` [PATCH v2 3/4] arm64: qcom: ipq5018: Add GEPHY RX and TX clocks George Moussalem via B4 Relay
2026-06-03 13:52 ` Dmitry Baryshkov
2026-06-02 6:50 ` [PATCH v2 4/4] net: phy: at803x: add RX and TX clock management for IPQ5018 PHY George Moussalem via B4 Relay
2026-06-03 6:50 ` sashiko-bot
2026-06-03 13:53 ` Dmitry Baryshkov
2026-06-03 14:33 ` George Moussalem
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=20260603065059.928F21F00898@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=devnull+george.moussalem.outlook.com@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