Patchwork [U-Boot,v2] fix compile warning for env tools

login
register
mail settings
Submitter Luka Perkov
Date Sept. 5, 2011, 9:40 p.m.
Message ID <20110905214013.GB12498@w500.gigaset.lan>
Download mbox | patch
Permalink /patch/113442/
State Accepted
Commit 8603b69b8b04e3e34f8744b396c62833b78fd7c1
Headers show

Comments

Luka Perkov - Sept. 5, 2011, 9:40 p.m.
Patch fixes this issue:

fw_env.c: In function ‘fw_setenv’:
fw_env.c:492:5: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘size_t’ [-Wformat]
fw_env.c: In function ‘flash_write_buf’:
fw_env.c:806:6: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘size_t’ [-Wformat]

Signed-off-by: Luka Perkov <lists@lukaperkov.net>
---
Mike Frysinger - Sept. 7, 2011, 4:25 a.m.
On Monday, September 05, 2011 17:40:13 Luka Perkov wrote:
> Patch fixes this issue:
> 
> fw_env.c: In function ‘fw_setenv’:
> fw_env.c:492:5: warning: format ‘%u’ expects argument of type ‘unsigned
> int’, but argument 3 has type ‘size_t’ [-Wformat] fw_env.c: In function
> ‘flash_write_buf’:
> fw_env.c:806:6: warning: format ‘%u’ expects argument of type ‘unsigned
> int’, but argument 3 has type ‘size_t’ [-Wformat]

Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
Wolfgang Denk - Oct. 21, 2011, 10:17 p.m.
Dear Luka Perkov,

In message <20110905214013.GB12498@w500.gigaset.lan> you wrote:
> Patch fixes this issue:
> 
> fw_env.c: In function ‘fw_setenv’:
> fw_env.c:492:5: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘size_t’ [-Wformat]
> fw_env.c: In function ‘flash_write_buf’:
> fw_env.c:806:6: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘size_t’ [-Wformat]
> 
> Signed-off-by: Luka Perkov <lists@lukaperkov.net>
> ---

Applied, thanks.

Best regards,

Wolfgang Denk

Patch

diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index ed6b53f..cd0cc31 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -488,7 +488,7 @@  int fw_setenv(int argc, char *argv[])
 			value = (char *)malloc(len - strlen(name));
 			if (!value) {
 				fprintf(stderr,
-				"Cannot malloc %u bytes: %s\n",
+				"Cannot malloc %zu bytes: %s\n",
 				len - strlen(name), strerror(errno));
 				return -1;
 			}
@@ -802,7 +802,7 @@  static int flash_write_buf (int dev, int fd, void *buf, size_t count,
 		data = malloc (erase_len);
 		if (!data) {
 			fprintf (stderr,
-				 "Cannot malloc %u bytes: %s\n",
+				 "Cannot malloc %zu bytes: %s\n",
 				 erase_len, strerror (errno));
 			return -1;
 		}