U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Evgeny Bachinin <EABachinin@sberdevices.ru>
To: Simon Glass <sjg@chromium.org>,
	Hector Palacios <hector.palacios@digi.com>,
	Marek Vasut <marex@denx.de>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	John Keeping <john@metanate.com>
Cc: <u-boot@lists.denx.de>, <kernel@sberdevices.ru>,
	<evgen89bachinin@gmail.com>,
	Evgeny Bachinin <EABachinin@sberdevices.ru>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>
Subject: [PATCH v2 3/4] test: fdt: fix run_commandf() warnings
Date: Mon, 20 Mar 2023 11:23:13 +0300	[thread overview]
Message-ID: <20230320082314.2018-4-EABachinin@sberdevices.ru> (raw)
In-Reply-To: <20230320082314.2018-1-EABachinin@sberdevices.ru>

Fix warnings both for 32bit and 64bit architecture after adding
printf-like attribute format for run_commandf():
warning: format ‘%x’ expects argument of type ‘unsigned int’, but
  argument 2 has type ‘ulong {aka long unsigned int}’ [-Wformat=]
  ret = run_commandf("fdt addr -c %08x", addr);
                     ^
Signed-off-by: Evgeny Bachinin <EABachinin@sberdevices.ru>
Cc: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Changes for v2:
- fdt_test_move(): due to addition of __printf(), fix compilation
after rebase atop 79bcd809f49 ("test: cmd: fdt: Test fdt move")
- not apply Reviewed-by due to changes above

 test/cmd/fdt.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c
index cdbaf8c425..538a30b909 100644
--- a/test/cmd/fdt.c
+++ b/test/cmd/fdt.c
@@ -168,7 +168,7 @@ static int fdt_test_addr(struct unit_test_state *uts)
 	/* Set the working FDT */
 	set_working_fdt_addr(0);
 	ut_assert_nextline("Working FDT set to 0");
-	ut_assertok(run_commandf("fdt addr %08x", addr));
+	ut_assertok(run_commandf("fdt addr %08lx", addr));
 	ut_assert_nextline("Working FDT set to %lx", addr);
 	ut_asserteq(addr, map_to_sysmem(working_fdt));
 	ut_assertok(ut_check_console_end(uts));
@@ -178,7 +178,7 @@ static int fdt_test_addr(struct unit_test_state *uts)
 	/* Set the control FDT */
 	fdt_blob = gd->fdt_blob;
 	gd->fdt_blob = NULL;
-	ret = run_commandf("fdt addr -c %08x", addr);
+	ret = run_commandf("fdt addr -c %08lx", addr);
 	new_fdt = gd->fdt_blob;
 	gd->fdt_blob = fdt_blob;
 	ut_assertok(ret);
@@ -187,7 +187,7 @@ static int fdt_test_addr(struct unit_test_state *uts)
 
 	/* Test setting an invalid FDT */
 	fdt[0] = 123;
-	ut_asserteq(1, run_commandf("fdt addr %08x", addr));
+	ut_asserteq(1, run_commandf("fdt addr %08lx", addr));
 	ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC");
 	ut_assertok(ut_check_console_end(uts));
 
@@ -216,19 +216,19 @@ static int fdt_test_addr_resize(struct unit_test_state *uts)
 
 	/* Test setting and resizing the working FDT to a larger size */
 	ut_assertok(console_record_reset_enable());
-	ut_assertok(run_commandf("fdt addr %08x %x", addr, newsize));
+	ut_assertok(run_commandf("fdt addr %08lx %x", addr, newsize));
 	ut_assert_nextline("Working FDT set to %lx", addr);
 	ut_assertok(ut_check_console_end(uts));
 
 	/* Try shrinking it */
-	ut_assertok(run_commandf("fdt addr %08x %x", addr, sizeof(fdt) / 4));
+	ut_assertok(run_commandf("fdt addr %08lx %zx", addr, sizeof(fdt) / 4));
 	ut_assert_nextline("Working FDT set to %lx", addr);
 	ut_assert_nextline("New length %d < existing length %d, ignoring",
 			   (int)sizeof(fdt) / 4, newsize);
 	ut_assertok(ut_check_console_end(uts));
 
 	/* ...quietly */
-	ut_assertok(run_commandf("fdt addr -q %08x %x", addr, sizeof(fdt) / 4));
+	ut_assertok(run_commandf("fdt addr -q %08lx %zx", addr, sizeof(fdt) / 4));
 	ut_assert_nextline("Working FDT set to %lx", addr);
 	ut_assertok(ut_check_console_end(uts));
 
@@ -258,13 +258,13 @@ static int fdt_test_move(struct unit_test_state *uts)
 
 	/* Test moving the working FDT to a new location */
 	ut_assertok(console_record_reset_enable());
-	ut_assertok(run_commandf("fdt move %08x %08x %x", addr, newaddr, ts));
+	ut_assertok(run_commandf("fdt move %08lx %08lx %x", addr, newaddr, ts));
 	ut_assert_nextline("Working FDT set to %lx", newaddr);
 	ut_assertok(ut_check_console_end(uts));
 
 	/* Compare the source and destination DTs */
 	ut_assertok(console_record_reset_enable());
-	ut_assertok(run_commandf("cmp.b %08x %08x %x", addr, newaddr, ts));
+	ut_assertok(run_commandf("cmp.b %08lx %08lx %x", addr, newaddr, ts));
 	ut_assert_nextline("Total of %d byte(s) were the same", ts);
 	ut_assertok(ut_check_console_end(uts));
 
-- 
2.17.1


  parent reply	other threads:[~2023-03-20  8:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20  8:23 [PATCH v2 0/4] cli: run_commandf() coverage and small fixups Evgeny Bachinin
2023-03-20  8:23 ` [PATCH v2 1/4] cli: run_commandf(): " Evgeny Bachinin
2023-03-20 18:40   ` Simon Glass
2023-03-31 14:15   ` Tom Rini
2023-03-20  8:23 ` [PATCH v2 2/4] unit-test: cover run_commandf() by test-cases Evgeny Bachinin
2023-03-20 18:40   ` Simon Glass
2023-03-31 14:15   ` Tom Rini
2023-03-20  8:23 ` Evgeny Bachinin [this message]
2023-03-20 18:40   ` [PATCH v2 3/4] test: fdt: fix run_commandf() warnings Simon Glass
2023-03-31 14:15   ` Tom Rini
2023-03-20  8:23 ` [PATCH v2 4/4] test: exit: " Evgeny Bachinin
2023-03-20 18:40   ` Simon Glass
2023-03-31 14:15   ` Tom Rini

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=20230320082314.2018-4-EABachinin@sberdevices.ru \
    --to=eabachinin@sberdevices.ru \
    --cc=evgen89bachinin@gmail.com \
    --cc=hector.palacios@digi.com \
    --cc=john@metanate.com \
    --cc=kernel@sberdevices.ru \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=marex@denx.de \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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