* [PATCH] net: phy: microchip_rds_ptp: unregister the PTP clock if init fails
@ 2026-11-03 10:29 Wentao Liang
2026-11-03 10:35 ` netdev-bot+sinfo
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-11-03 10:29 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Wentao Liang, stable
mchp_rds_ptp_probe() registers the PTP clock with ptp_clock_register()
and then initializes the hardware with mchp_rds_ptp_init(). The
initialization performs several MDIO writes and can fail, in which case
the function returns an error to the caller without unregistering the
clock that was just registered.
Nothing else releases that clock: the callers abort the PHY probe, and
the clock object allocated by ptp_clock_register(), together with its
character device and sysfs entries, stays around forever.
Unregister the clock on the error path, mirroring what the remove
callbacks of the other PTP capable PHY drivers do.
Fixes: fa51199c5f34 ("net: phy: microchip_rds_ptp : Add rds ptp library for Microchip phys")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/net/phy/microchip_rds_ptp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/microchip_rds_ptp.c b/drivers/net/phy/microchip_rds_ptp.c
index 2ad95d5c9d86..0db6eeb2660c 100644
--- a/drivers/net/phy/microchip_rds_ptp.c
+++ b/drivers/net/phy/microchip_rds_ptp.c
@@ -1318,8 +1318,10 @@ struct mchp_rds_ptp_clock *mchp_rds_ptp_probe(struct phy_device *phydev, u8 mmd,
clock->phydev = phydev;
rc = mchp_rds_ptp_init(clock);
- if (rc < 0)
+ if (rc < 0) {
+ ptp_clock_unregister(clock->ptp_clock);
return ERR_PTR(rc);
+ }
return clock;
}
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net: phy: microchip_rds_ptp: unregister the PTP clock if init fails
2026-11-03 10:29 [PATCH] net: phy: microchip_rds_ptp: unregister the PTP clock if init fails Wentao Liang
@ 2026-11-03 10:35 ` netdev-bot+sinfo
0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-03 10:35 UTC (permalink / raw)
To: Wentao Liang
Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
stable
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by code inspection). If it was triggered please include
the symptoms, like the stack trace or error messages.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-03 10:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 10:29 [PATCH] net: phy: microchip_rds_ptp: unregister the PTP clock if init fails Wentao Liang
2026-11-03 10:35 ` netdev-bot+sinfo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®