Skip to contentSkip to conversation

tools/atmelimage.c: Fix warning when debug is enabled

PATCH Superseded Tom Rini 2 participants 7 messages Aug 26, 2015 – Oct 12, 2015 1 message not in the archive Arm/Microchip (AT91) SoC support

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/2 tools/atmelimage.c: Fix warning when debug is enabled

Otherwise we get:
tools/atmelimage.c:134:3: warning: format ?%d? expects argument of type ?int?, but argument 2 has type ?size_t? [-Wformat=] debug("atmelimage: interrupt vector #%d is 0x%08X\n", pos+1,
^

---
 tools/atmelimage.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/atmelimage.c +1 -1
index 5b72ac5..0979eef 100644
@@ -131,7 +131,7 @@ static int atmel_verify_header(unsigned char *ptr, int image_size,
 
 	/* check the seven interrupt vectors of binary */
 	for (pos = 0; pos < 7; pos++) {
-		debug("atmelimage: interrupt vector #%d is 0x%08X\n", pos+1,
+		debug("atmelimage: interrupt vector #%ld is 0x%08X\n", pos+1,
 		      ints[pos]);
 		/*
 		 * all vectors except the 6'th one must contain valid
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/2 tools/mkimage.c: Clarify help text for -D slightly

Try and make it clear that -D will replace all arguments passed to dtc and is not appending them.

---
 tools/mkimage.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/mkimage.c +1 -1
index e81d455..22449cc 100644
@@ -594,7 +594,7 @@ static void usage(void)
 		params.cmdname);
 	fprintf(stderr, "       %s [-D dtc_options] [-f fit-image.its|-F] fit-image\n",
 		params.cmdname);
-	fprintf(stderr, "          -D => set options for device tree compiler\n"
+	fprintf(stderr, "          -D => set all options for device tree compiler\n"
 			"          -f => input filename for FIT source\n");
 #ifdef CONFIG_FIT_SIGNATURE
 	fprintf(stderr, "Signing / verified boot options: [-k keydir] [-K dtb] [ -c <comment>] [-r]\n"
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/2 tools/mkimage.c: Clarify help text for -D slightly

Quoted 4 lines · Tom Rini

Try and make it clear that -D will replace all arguments passed to dtc and is not appending them.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151012/42900209/attachment.sig>
#3 lore raw

PATCH 1/2 tools/atmelimage.c: Fix warning when debug is enabled

In reply to Tom Rini

Hi Tom,

Quoted 15 lines · Tom Rini

Otherwise we get:
tools/atmelimage.c:134:3: warning: format ?%d? expects argument of type ?int?, but argument 2 has type ?size_t? [-Wformat=] debug("atmelimage: interrupt vector #%d is 0x%08X\n", pos+1,
^

---
 tools/atmelimage.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/atmelimage.c +0 -0
index 5b72ac5..0979eef 100644

tools/atmelimage.c static int atmel_verify_header(unsigned char *ptr, int image_size, · line 134

Quoted 5 lines
tools/atmelimage.c +1 -1
@@ -131,7 +131,7 @@ static int atmel_verify_header(unsigned char *ptr, int image_size,
 
 	/* check the seven interrupt vectors of binary */
 	for (pos = 0; pos < 7; pos++) {
-		debug("atmelimage: interrupt vector #%d is 0x%08X\n", pos+1,
+		debug("atmelimage: interrupt vector #%ld is 0x%08X\n", pos+1,

I'd rather use the '%zu' modifier here. On 32 Bit systems the size_t might be a simple int and not a long int which also leads to warnings.

Andreas

Quoted 4 lines
tools/atmelimage.c +0 -0
 		      ints[pos]);
 		/*
 		 * all vectors except the 6'th one must contain valid
author
#4 lore raw

PATCH 1/2 tools/atmelimage.c: Fix warning when debug is enabled

Quoted 19 lines · Andreas Bie?mann

Hi Tom,

Quoted 16 lines · Tom Rini

Otherwise we get:
tools/atmelimage.c:134:3: warning: format ?%d? expects argument of type ?int?, but argument 2 has type ?size_t? [-Wformat=] debug("atmelimage: interrupt vector #%d is 0x%08X\n", pos+1,
^

---
 tools/atmelimage.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/atmelimage.c +0 -0
index 5b72ac5..0979eef 100644
@@ -131,7 +131,7 @@ static int atmel_verify_header(unsigned char *ptr, int image_size,
 
Quoted 7 lines

tools/atmelimage.c static int atmel_verify_header(unsigned char *ptr, int image_size, · line 134

Quoted 4 lines
tools/atmelimage.c +1 -1
 	/* check the seven interrupt vectors of binary */
 	for (pos = 0; pos < 7; pos++) {
-		debug("atmelimage: interrupt vector #%d is 0x%08X\n", pos+1,
+		debug("atmelimage: interrupt vector #%ld is 0x%08X\n", pos+1,

I'd rather use the '%zu' modifier here. On 32 Bit systems the size_t might be a simple int and not a long int which also leads to warnings.

Oh that's right, %zu is what you should do for size_t. I thought I was doing something wrong but couldn't recall. Thanks, I'll v2 later today.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150827/297db970/attachment.sig>

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

PATCH v2 1/2 tools/atmelimage.c: Fix warning when debug is enabled

+u-boot ML

Quoted 7 lines · Tom Rini

Otherwise we get:
tools/atmelimage.c:134:3: warning: format ?%d? expects argument of type ?int?, but argument 2 has type ?size_t? [-Wformat=] debug("atmelimage: interrupt vector #%d is 0x%08X\n", pos+1,
^

Cc Andreas Bie?mann <[email protected]>
Quoted 22 lines

---
Changes in v2:
- Use %zu not %ld as noted by Andreas Bie?mann

---
 tools/atmelimage.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/atmelimage.c +1 -1
index 5b72ac5..6b5603e 100644
@@ -131,7 +131,7 @@ static int atmel_verify_header(unsigned char *ptr, int image_size,
 
 	/* check the seven interrupt vectors of binary */
 	for (pos = 0; pos < 7; pos++) {
-		debug("atmelimage: interrupt vector #%d is 0x%08X\n", pos+1,
+		debug("atmelimage: interrupt vector #%zu is 0x%08X\n", pos+1,
 		      ints[pos]);
 		/*
 		 * all vectors except the 6'th one must contain valid
author
#7 lore raw

PATCH v2 1/2 tools/atmelimage.c: Fix warning when debug is enabled

Quoted 8 lines · Andreas Bie?mann

+u-boot ML

Quoted 5 lines · Tom Rini

Otherwise we get:
tools/atmelimage.c:134:3: warning: format ?%d? expects argument of type ?int?, but argument 2 has type ?size_t? [-Wformat=] debug("atmelimage: interrupt vector #%d is 0x%08X\n", pos+1,
^

Quoted 4 lines
Quoted 2 lines
Cc Andreas Bie?mann <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150828/2df6cce4/attachment.sig>