* [PATCH net] ptp: fc3: unregister PTP clock on probe failure
@ 2026-07-29 2:17 Myeonghun Pak
0 siblings, 0 replies; only message in thread
From: Myeonghun Pak @ 2026-07-29 2:17 UTC (permalink / raw)
To: Richard Cochran
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel, stable, Myeonghun Pak,
Ijae Kim
ptp_clock_register() leaves a registered clock referring to the clock
information embedded in idtfc3. If either post-registration operation
fails, probe returns and devres frees idtfc3 without unregistering the
clock.
Unregister the clock on both post-registration failure paths.
Fixes: 1ddfecafabf7 ("ptp: add FemtoClock3 Wireless as ptp hardware clock")
Cc: stable@vger.kernel.org
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
drivers/ptp/ptp_fc3.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/ptp/ptp_fc3.c b/drivers/ptp/ptp_fc3.c
--- a/drivers/ptp/ptp_fc3.c
+++ b/drivers/ptp/ptp_fc3.c
@@ -835,11 +835,11 @@ static int idtfc3_enable_ptp(struct idtfc3 *idtfc3)
err = idtfc3_set_overhead(idtfc3);
if (err)
- return err;
+ goto err_unregister_clock;
err = idtfc3_init_timecounter(idtfc3);
if (err)
- return err;
+ goto err_unregister_clock;
dev_info(idtfc3->dev, "TIME_SYNC_CHANNEL registered as ptp%d",
idtfc3->ptp_clock->index);
@@ -847,4 +847,8 @@ static int idtfc3_enable_ptp(struct idtfc3 *idtfc3)
return 0;
+
+err_unregister_clock:
+ ptp_clock_unregister(idtfc3->ptp_clock);
+ return err;
}
static int idtfc3_load_firmware(struct idtfc3 *idtfc3)
--
2.50.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-29 2:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 2:17 [PATCH net] ptp: fc3: unregister PTP clock on probe failure Myeonghun Pak
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.