[PATCH] timekeeping: Use min() to fix Coccinelle warning

From: Thorsten Blum
Date: Mon Jun 24 2024 - 02:24:54 EST


Fixes the following Coccinelle/coccicheck warning reported by
minmax.cocci:

WARNING opportunity for min()

Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxxx>
---
kernel/time/timekeeping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 4e18db1819f8..f1a9c52b7c66 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -799,7 +799,7 @@ static void timekeeping_forward_now(struct timekeeper *tk)

while (delta > 0) {
u64 max = tk->tkr_mono.clock->max_cycles;
- u64 incr = delta < max ? delta : max;
+ u64 incr = min(delta, max);

tk->tkr_mono.xtime_nsec += incr * tk->tkr_mono.mult;
tk->tkr_raw.xtime_nsec += incr * tk->tkr_raw.mult;
--
2.45.2