Re: [PATCH 39/44] mm: use min() instead of min_t()

From: David Hildenbrand (Red Hat)

Date: Thu Nov 20 2025 - 04:20:48 EST


On 11/19/25 23:41, david.laight.linux@xxxxxxxxx wrote:
From: David Laight <david.laight.linux@xxxxxxxxx>

min_t(unsigned int, a, b) casts an 'unsigned long' to 'unsigned int'.
Use min(a, b) instead as it promotes any 'unsigned int' to 'unsigned long'
and so cannot discard significant bits.

I thought using min() was frowned upon and we were supposed to use min_t() instead to make it clear which type we want to use.

Do I misremember or have things changed?

Wasn't there a checkpatch warning that states exactly that?

--
Cheers

David