[PATCH 17/44] drivers/cxl: use min() instead of min_t()

From: david . laight . linux

Date: Wed Nov 19 2025 - 17:42:57 EST


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.

In this case the 'unsigned long' value is small enough that the result
is ok.

Detected by an extra check added to min_t().

Signed-off-by: David Laight <david.laight.linux@xxxxxxxxx>
---
drivers/cxl/core/mbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index fa6dd0c94656..17aec916e8cd 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -663,7 +663,7 @@ static int cxl_xfer_log(struct cxl_memdev_state *mds, uuid_t *uuid,
u32 offset = 0;

while (remaining) {
- u32 xfer_size = min_t(u32, remaining, cxl_mbox->payload_size);
+ u32 xfer_size = min(remaining, cxl_mbox->payload_size);
struct cxl_mbox_cmd mbox_cmd;
struct cxl_mbox_get_log log;
int rc;
--
2.39.5