[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251119224140.8616-18-david.laight.linux@gmail.com>
Date: Wed, 19 Nov 2025 22:41:13 +0000
From: david.laight.linux@...il.com
To: linux-kernel@...r.kernel.org,
linux-cxl@...r.kernel.org
Cc: Alison Schofield <alison.schofield@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
Davidlohr Bueso <dave@...olabs.net>,
Ira Weiny <ira.weiny@...el.com>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
Vishal Verma <vishal.l.verma@...el.com>,
David Laight <david.laight.linux@...il.com>
Subject: [PATCH 17/44] drivers/cxl: use min() instead of min_t()
From: David Laight <david.laight.linux@...il.com>
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@...il.com>
---
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
Powered by blists - more mailing lists