From: Yuho Choi <oss.patchbox@gmail.com>
To: Jerome Forissier <jerome.forissier@arm.com>
Cc: Tom Rini <trini@konsulko.com>,
Patrice Chotard <patrice.chotard@foss.st.com>,
Michael Chang <zhang971090220@gmail.com>,
Stanley Chu <yschu@nuvoton.com>,
Sean Anderson <sanderson@brivo.com>,
Simon Glass <sjg@chromium.org>,
u-boot@lists.u-boot-project.org,
Yuho Choi <oss.patchbox@gmail.com>
Subject: [PATCH] net: designware: Release the clocks if the PHY supply fails
Date: Tue, 3 Nov 2026 14:05:21 -0500 [thread overview]
Message-ID: <20261103190537.1096121-1-oss.patchbox@gmail.com> (raw)
designware_eth_probe() enables the clocks of the MAC before it enables
the PHY supply. If regulator_set_enable_if_allowed() fails, or on
NPCM8xx if setting "phy-supply-microvolt" fails, the probe returns
directly and skips the clk_release_all() at the end of the function. A
failed probe does not call designware_eth_remove(), so the clocks are
left enabled.
Go to the error path instead, as the later failures in the probe do.
This uses the mdio_err label, because clk_err only exists with
CONFIG_CLK; nothing between the two labels has been set up yet. The
PHY supply itself is still left enabled, as on the other error paths
and in designware_eth_remove().
Fixes: ba1f96672522 ("net: designware: add clock support")
Fixes: 8897f91a5397 ("net: designware: support phy io micro voltage setting.")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
Build-tested only, on nanopi-r2s-rk3328 and A20-OLinuXino-Lime2
(CLK=y, DM_REGULATOR=y), arbel_evb (NPCM8XX) and socfpga_arria10
(DM_REGULATOR=n), with no new warnings in designware.c at W=1. I also
compiled designware.c with CONFIG_CLK undefined, since CLK is selected
on all these boards. Not tested at runtime: I have no board where the
PHY supply fails.
drivers/net/designware.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 9470804ebd1..52dd08da82a 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -927,7 +927,8 @@ int designware_eth_probe(struct udevice *dev)
ret = regulator_set_enable_if_allowed(phy_supply, true);
if (ret) {
puts("Error enabling phy supply\n");
- return ret;
+ err = ret;
+ goto mdio_err;
}
#if IS_ENABLED(CONFIG_ARCH_NPCM8XX)
int phy_uv;
@@ -937,7 +938,8 @@ int designware_eth_probe(struct udevice *dev)
ret = regulator_set_value(phy_supply, phy_uv);
if (ret) {
puts("Error setting phy voltage\n");
- return ret;
+ err = ret;
+ goto mdio_err;
}
}
#endif
--
2.43.0
next reply other threads:[~2026-11-03 20:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 19:05 Yuho Choi [this message]
2026-11-06 18:06 ` [PATCH] net: designware: Release the clocks if the PHY supply fails Jerome Forissier
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=20261103190537.1096121-1-oss.patchbox@gmail.com \
--to=oss.patchbox@gmail.com \
--cc=jerome.forissier@arm.com \
--cc=patrice.chotard@foss.st.com \
--cc=sanderson@brivo.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--cc=yschu@nuvoton.com \
--cc=zhang971090220@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