[PATCH v4 12/14] of: reserved-memory: Move an assignment to effective place in __reserved_mem_alloc_size()

From: Zijun Hu
Date: Thu Jan 09 2025 - 08:30:51 EST


From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>

The assignment '@base = 0' in __reserved_mem_alloc_size() is meaningless
since @base was already initialized to 0.

Move the assignment to effective and proper place.

Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
---
drivers/of/of_reserved_mem.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index e2da88d7706ab3c208386e29f31350178e67cd14..75e819f66a56139a800dba5e2e0044d0bbeb065e 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -441,13 +441,12 @@ static int __init __reserved_mem_alloc_size(unsigned long node, const char *unam
return -EINVAL;
}

- base = 0;
-
while (len > 0) {
start = dt_mem_next_cell(dt_root_addr_cells, &prop);
end = start + dt_mem_next_cell(dt_root_size_cells,
&prop);

+ base = 0;
ret = __reserved_mem_alloc_in_range(size, align,
start, end, nomap, &base);
if (ret == 0) {

--
2.34.1