From: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
To: Devicetree Discuss
<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>
Subject: [PATCH 1/4] fdtget: Fix multiple arg bug and add test for it
Date: Fri, 2 Mar 2012 17:12:07 -0800 [thread overview]
Message-ID: <1330737130-29600-1-git-send-email-sjg@chromium.org> (raw)
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-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
fdtget.c | 6 +++---
tests/fdtget-runtest.sh | 2 +-
tests/run_tests.sh | 3 +++
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/fdtget.c b/fdtget.c
index 2c384b6..9783e04 100644
--- a/fdtget.c
+++ b/fdtget.c
@@ -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;
diff --git a/tests/fdtget-runtest.sh b/tests/fdtget-runtest.sh
index dac7f9a..982fbe1 100755
--- a/tests/fdtget-runtest.sh
+++ b/tests/fdtget-runtest.sh
@@ -8,7 +8,7 @@ rm -f $LOG $EXPECT
trap "rm -f $LOG $EXPECT" 0
expect="$1"
-echo $expect >$EXPECT
+echo -e $expect >$EXPECT
shift
verbose_run_log_check "$LOG" $VALGRIND $DTGET "$@"
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index a561433..ac6fa17 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -475,6 +475,9 @@ fdtget_tests () {
run_fdtget_test "61 62 63 0 12 34 0 0 0 a 0 0 0 b 0 0 0 c" \
-thhx $dtb /randomnode mixed
run_wrap_error_test $DTGET -ts $dtb /randomnode doctor-who
+
+ # Test multiple arguments
+ run_fdtget_test "MyBoardName\nmemory" -ts $dtb / model /memory device_type
}
fdtput_tests () {
--
1.7.7.3
next reply other threads:[~2012-03-03 1:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-03 1:12 Simon Glass [this message]
[not found] ` <1330737130-29600-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-03-03 1:12 ` [PATCH 2/4] fdtget: Add -p to list the properties of a node Simon Glass
[not found] ` <1330737130-29600-2-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-03-06 2:22 ` David Gibson
2012-03-07 19:27 ` Jon Loeliger
[not found] ` <E1S5MWl-000880-59-CYoMK+44s/E@public.gmane.org>
2012-03-07 23:38 ` David Gibson
[not found] ` <20120307233853.GN1929-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2012-03-08 1:25 ` Jon Loeliger
[not found] ` <E1S5S6J-0001jL-27-CYoMK+44s/E@public.gmane.org>
2012-03-08 1:31 ` David Gibson
2012-03-03 1:12 ` [PATCH 3/4] fdtget: Add -l to list the children " Simon Glass
[not found] ` <1330737130-29600-3-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-03-06 2:23 ` David Gibson
[not found] ` <20120306022323.GC12818-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2012-03-07 0:37 ` Simon Glass
2012-03-07 19:27 ` Jon Loeliger
2012-03-03 1:12 ` [PATCH 4/4] fdtget: Add -d to provide a default value Simon Glass
[not found] ` <1330737130-29600-4-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-03-06 2:23 ` David Gibson
2012-03-07 19:28 ` Jon Loeliger
2012-03-06 2:21 ` [PATCH 1/4] fdtget: Fix multiple arg bug and add test for it David Gibson
2012-03-07 19:27 ` Jon Loeliger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330737130-29600-1-git-send-email-sjg@chromium.org \
--to=sjg-f7+t8e8rja9g9huczpvpmw@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).