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

From: John Stultz
Date: Mon Jun 24 2024 - 14:31:00 EST


On Sun, Jun 23, 2024 at 11:24 PM Thorsten Blum <thorsten.blum@xxxxxxxxxx> wrote:
>
> 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);

Acked-by: John Stultz <jstultz@xxxxxxxxxx>

thanks
-john