[PATCH master 12/13] hw_random: fix compilation with 64-bit size_t
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Oct 14 04:39:11 PDT 2024
max has the type size_t, while data_size is a u32.
This doesn't matter for 32-bit OMAP, but has min() trigger a compile
error when compile testing for 64-bit. Add a cast via min_t to fix this.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/hw_random/omap-rng.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hw_random/omap-rng.c b/drivers/hw_random/omap-rng.c
index 9fa50bc8e7a9..6b69994aad0b 100644
--- a/drivers/hw_random/omap-rng.c
+++ b/drivers/hw_random/omap-rng.c
@@ -190,7 +190,7 @@ static int omap_rng_do_read(struct hwrng *rng, void *data, size_t max,
if (!present)
return 0;
- max = min(max, priv->pdata->data_size);
+ max = min_t(size_t, max, priv->pdata->data_size);
memcpy_fromio(data, priv->base + priv->pdata->regs[RNG_OUTPUT_0_REG], max);
--
2.39.5
More information about the barebox
mailing list