[PATCH net-next] ptp: Use ratelimite for freerun error message

Breno Leitao posted 1 patch 3 months, 4 weeks ago
drivers/ptp/ptp_clock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH net-next] ptp: Use ratelimite for freerun error message
Posted by Breno Leitao 3 months, 4 weeks ago
Replace pr_err() with pr_err_ratelimited() in ptp_clock_settime() to
prevent log flooding when the physical clock is free running, which
happens on some of my hosts. This ensures error messages are
rate-limited and improves kernel log readability.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/ptp/ptp_clock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 35a5994bf64f6..335e88d3ebdff 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -96,7 +96,7 @@ static int ptp_clock_settime(struct posix_clock *pc, const struct timespec64 *tp
 	struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
 
 	if (ptp_clock_freerun(ptp)) {
-		pr_err("ptp: physical clock is free running\n");
+		pr_err_ratelimited("ptp: physical clock is free running\n");
 		return -EBUSY;
 	}
 

---
base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
change-id: 20250613-ptp-58caf257a064

Best regards,
-- 
Breno Leitao <leitao@debian.org>
Re: [PATCH net-next] ptp: Use ratelimite for freerun error message
Posted by Simon Horman 3 months, 3 weeks ago
On Fri, Jun 13, 2025 at 10:15:46AM -0700, Breno Leitao wrote:
> Replace pr_err() with pr_err_ratelimited() in ptp_clock_settime() to
> prevent log flooding when the physical clock is free running, which
> happens on some of my hosts. This ensures error messages are
> rate-limited and improves kernel log readability.
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>

Reviewed-by: Simon Horman <horms@kernel.org>