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 <[email protected]>
Acked-by: David Gibson <[email protected]>
diff --git a/fdtget.c b/fdtget.c
index 2c384b6..9783e04 100644
--- a/fdtget.c
+++ b/fdtget.c
@@ -146,13 +146,13 @@
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;