From 82944f65a0a59a44c397e3e22d592afdfb9b3074 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Beh=C3=BAn?= Date: Sat, 31 Aug 2024 11:20:49 +0200 Subject: [PATCH] firmware: turris-mox-rwtm: Use ALIGN() instead of hardcoding MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Use ALIGN(max, 4) instead of hardcoding ((max + 3) & ~3). Signed-off-by: Marek Behún Link: https://lore.kernel.org/r/20240831092050.23093-16-kabel@kernel.org Signed-off-by: Arnd Bergmann --- drivers/firmware/turris-mox-rwtm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c index a9391705f5b4d..0c7d8c96ea17f 100644 --- a/drivers/firmware/turris-mox-rwtm.c +++ b/drivers/firmware/turris-mox-rwtm.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -268,7 +269,7 @@ static int mox_hwrng_read(struct hwrng *rng, void *data, size_t max, bool wait) msg.command = MBOX_CMD_GET_RANDOM; msg.args[0] = 1; msg.args[1] = rwtm->buf_phys; - msg.args[2] = (max + 3) & ~3; + msg.args[2] = ALIGN(max, 4); if (!wait) { if (!mutex_trylock(&rwtm->busy)) -- 2.47.3