Subject: Re: [PATCH net-next 11/15] net: macb: replace min() with umin() calls

From: Théo Lebrun <[email-masked]>
Date: Mon, 20 Oct 2025 13:44:43 +0200

On Sun Oct 19, 2025 at 4:10 PM CEST, David Laight wrote:
> On Tue, 14 Oct 2025 17:25:12 +0200
> Théo Lebrun <[email-masked]> wrote:
>
>> Whenever min(a, b) is used with a and b unsigned variables or literals,
>> `make W=2` complains. Change four min() calls into umin().
>
> It will, and you'll get the same 'error' all over the place.
> Basically -Wtype-limits is broken.
>
> Don't remove valid checks because it bleats.

In theory I agree. In practice, this patch leads to a more readable
`make W=2 drivers/net/ethernet/cadence/` stderr output, by removing a
few false positives, and that's my only desire (not quite).

I am not sure what you mean by "Don't remove valid checks"; could you
clarify? My understanding is that the warning checks are about the
signedness of unsigned integers. Are you implying that we lose
something (safety?) when switching from min(a, b) to umin(a, b) with
a/b both unsigned ints?

Thanks David,

[0]: https://lore.kernel.org/lkml/[email-masked]/
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=f26c6438a285

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com