mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:04:51 +01:00
of/fdt: Fix incorrect use of dt_root_addr_cells in early_init_dt_check_kho()
When reading the fdt_size value, the argument passed to dt_mem_next_cell()
is dt_root_addr_cells, but it should be dt_root_size_cells.
The same issue occurs when reading the scratch_size value.
Use a helper function to simplify the code and fix these issues.
Fixes: 274cdcb1c0 ("arm64: add KHO support")
Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
Link: https://patch.msgid.link/20251115134753.179931-5-yuntao.wang@linux.dev
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
This commit is contained in:
parent
463942de13
commit
c85da64ce2
1 changed files with 4 additions and 12 deletions
|
|
@ -922,26 +922,18 @@ static void __init early_init_dt_check_kho(void)
|
|||
{
|
||||
unsigned long node = chosen_node_offset;
|
||||
u64 fdt_start, fdt_size, scratch_start, scratch_size;
|
||||
const __be32 *p;
|
||||
int l;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_KEXEC_HANDOVER) || (long)node < 0)
|
||||
return;
|
||||
|
||||
p = of_get_flat_dt_prop(node, "linux,kho-fdt", &l);
|
||||
if (l != (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32))
|
||||
if (!of_flat_dt_get_addr_size(node, "linux,kho-fdt",
|
||||
&fdt_start, &fdt_size))
|
||||
return;
|
||||
|
||||
fdt_start = dt_mem_next_cell(dt_root_addr_cells, &p);
|
||||
fdt_size = dt_mem_next_cell(dt_root_addr_cells, &p);
|
||||
|
||||
p = of_get_flat_dt_prop(node, "linux,kho-scratch", &l);
|
||||
if (l != (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32))
|
||||
if (!of_flat_dt_get_addr_size(node, "linux,kho-scratch",
|
||||
&scratch_start, &scratch_size))
|
||||
return;
|
||||
|
||||
scratch_start = dt_mem_next_cell(dt_root_addr_cells, &p);
|
||||
scratch_size = dt_mem_next_cell(dt_root_addr_cells, &p);
|
||||
|
||||
kho_populate(fdt_start, fdt_size, scratch_start, scratch_size);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue