Skip to content

Commit 09bb95d

Browse files
MrVanSudeep Holla
authored andcommitted
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>
1 parent d8283ac commit 09bb95d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • drivers/firmware/arm_scmi

drivers/firmware/arm_scmi/base.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#define pr_fmt(fmt) "SCMI Notifications BASE - " fmt
99

10+
#include <linux/math.h>
1011
#include <linux/module.h>
1112
#include <linux/scmi_protocol.h>
1213

@@ -219,8 +220,7 @@ scmi_base_implementation_list_get(const struct scmi_protocol_handle *ph,
219220
}
220221

221222
real_list_sz = t->rx.len - sizeof(u32);
222-
calc_list_sz = (1 + (loop_num_ret - 1) / sizeof(u32)) *
223-
sizeof(u32);
223+
calc_list_sz = round_up(loop_num_ret, sizeof(u32));
224224
if (calc_list_sz != real_list_sz) {
225225
dev_warn(dev,
226226
"Malformed reply - real_sz:%zd calc_sz:%u (loop_num_ret:%d)\n",

0 commit comments

Comments
 (0)