fdtget: Fix multiple arg bug and add test for it

There is a rather unfortunate bug in fdtget in that if multiple argument
sets are provided, it just repeats displaying the first set ones for
each set.

Fix this bug and add a test for it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Simon Glass
2012-03-02 17:12:07 -08:00
committed by Jon Loeliger
parent a6e6c60e3a
commit 097ec97c1a
3 changed files with 7 additions and 4 deletions

View File

@@ -146,13 +146,13 @@ static int do_fdtget(struct display_info *disp, const char *filename,
return -1;
for (i = 0; i + 2 <= arg_count; i += 2) {
node = fdt_path_offset(blob, arg[0]);
node = fdt_path_offset(blob, arg[i]);
if (node < 0) {
report_error(arg[0], node);
report_error(arg[i], node);
return -1;
}
if (show_data_for_item(blob, disp, node, arg[1]))
if (show_data_for_item(blob, disp, node, arg[i + 1]))
return -1;
}
return 0;