summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2026-02-28 11:37:33 +0800
committerSudeep Holla <sudeep.holla@kernel.org>2026-03-08 13:12:00 +0000
commit09bb95d63adeaab7b07127cfce4ecbeff9ab6488 (patch)
treee9648ed65f2f04a4d576fbc12cec6acfea8367dd
parentd8283ac2c8fbf2b459672064ebff718fbefae226 (diff)
downloadlinux-09bb95d63adeaab7b07127cfce4ecbeff9ab6488.tar.gz
linux-09bb95d63adeaab7b07127cfce4ecbeff9ab6488.zip
firmware: arm_scmi: Use round_up() for base protocol list size calculation
Replace the open-coded size rounding logic with the kernel's round_up() helper to improve readability and align with common kernel practices. The original expression: (1 + (loop_num_ret - 1) / sizeof(u32)) * sizeof(u32) is equivalent to rounding up loop_num_ret to the nearest multiple of sizeof(u32), which is exactly what round_up() does. No functional change. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Message-Id: <20260228-scmi-check-v1-1-4935b58bb2db@nxp.com> Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
-rw-r--r--drivers/firmware/arm_scmi/base.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/firmware/arm_scmi/base.c b/drivers/firmware/arm_scmi/base.c
index 22267bbd0f4d..cd1331c2fc40 100644
--- a/drivers/firmware/arm_scmi/base.c
+++ b/drivers/firmware/arm_scmi/base.c
@@ -7,6 +7,7 @@
#define pr_fmt(fmt) "SCMI Notifications BASE - " fmt
+#include <linux/math.h>
#include <linux/module.h>
#include <linux/scmi_protocol.h>
@@ -219,8 +220,7 @@ scmi_base_implementation_list_get(const struct scmi_protocol_handle *ph,
}
real_list_sz = t->rx.len - sizeof(u32);
- calc_list_sz = (1 + (loop_num_ret - 1) / sizeof(u32)) *
- sizeof(u32);
+ calc_list_sz = round_up(loop_num_ret, sizeof(u32));
if (calc_list_sz != real_list_sz) {
dev_warn(dev,
"Malformed reply - real_sz:%zd calc_sz:%u (loop_num_ret:%d)\n",