spl: atf: traverse all "/fit-images" sub nodes

Fix find sub nodes failed.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I2cb885028da9711a15f001fdd48e9d273cfd348a
This commit is contained in:
Joseph Chen 2020-11-25 16:02:29 +08:00 committed by Jianhong Chen
parent 038c1ecaa2
commit 69a04b4fa5
1 changed files with 3 additions and 8 deletions

View File

@ -119,7 +119,7 @@ void bl31_entry(uintptr_t bl31_entry, uintptr_t bl32_entry,
static int spl_fit_images_find(void *blob, int os)
{
int parent, node, ndepth;
int parent, node;
const void *data;
if (!blob)
@ -129,19 +129,14 @@ static int spl_fit_images_find(void *blob, int os)
if (parent < 0)
return -FDT_ERR_NOTFOUND;
for (node = fdt_next_node(blob, parent, &ndepth);
(node >= 0) && (ndepth > 0);
node = fdt_next_node(blob, node, &ndepth)) {
if (ndepth != 1)
continue;
fdt_for_each_subnode(node, blob, parent) {
data = fdt_getprop(blob, node, FIT_OS_PROP, NULL);
if (!data)
continue;
if (genimg_get_os_id(data) == os)
return node;
};
}
return -FDT_ERR_NOTFOUND;
}