Skip to content

Commit 267b21d

Browse files
zijun-hurobherring
authored andcommitted
of: reserved-memory: Fix using wrong number of cells to get property 'alignment'
According to DT spec, size of property 'alignment' is based on parent node’s #size-cells property. But __reserved_mem_alloc_size() wrongly uses @dt_root_addr_cells to get the property obviously. Fix by using @dt_root_size_cells instead of @dt_root_addr_cells. Fixes: 3f0c820 ("drivers: of: add initialization code for dynamic reserved memory") Cc: stable@vger.kernel.org Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com> Link: https://lore.kernel.org/r/20250109-of_core_fix-v4-9-db8a72415b8c@quicinc.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
1 parent 1734514 commit 267b21d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/of/of_reserved_mem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,12 @@ static int __init __reserved_mem_alloc_size(unsigned long node, const char *unam
409409

410410
prop = of_get_flat_dt_prop(node, "alignment", &len);
411411
if (prop) {
412-
if (len != dt_root_addr_cells * sizeof(__be32)) {
412+
if (len != dt_root_size_cells * sizeof(__be32)) {
413413
pr_err("invalid alignment property in '%s' node.\n",
414414
uname);
415415
return -EINVAL;
416416
}
417-
align = dt_mem_next_cell(dt_root_addr_cells, &prop);
417+
align = dt_mem_next_cell(dt_root_size_cells, &prop);
418418
}
419419

420420
nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;

0 commit comments

Comments
 (0)