[U-Boot] [PATCH] kwbimage.c: Fix compile warning when building on 32/64 bit systems

Stefan Roese sr at denx.de
Tue Sep 15 10:10:23 CEST 2009


Commit 51003b89 [kwbimage.c: Fix compile warning when building on
64 bit systems] changed the printf format for "sizeof(uint32_t)"
from "%d" to "%ld". This now generates the following warning on
32 bit build systems:

tools/kwbimage.c: In function ‘kwbimage_checksum32’:
tools/kwbimage.c:135: warning: format ‘%ld’ expects type ‘long int’,
but argument 4 has type ‘unsigned int’

The problem is that sizeof(uint32_t) has different types on 32 bit and
64 bit build systems. This patch now changes the format to "%d" again and
casts sizeof() to uint32_t, fixing the problem on both build systems.

Signed-off-by: Stefan Roese <sr at denx.de>
Cc: Wolfgang Denk <wd at denx.de>
Cc: Prafulla Wadaskar <prafulla at marvell.com>
---
 tools/kwbimage.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index ee067cb..2c542da 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -131,8 +131,8 @@ static uint32_t kwbimage_checksum32 (uint32_t *start, uint32_t len, uint32_t csu
 		return 0;
 
 	if (len % sizeof(uint32_t)) {
-		printf ("Error:%s[%d] - lenght is not in multiple of %ld\n",
-			__FUNCTION__, len, sizeof(uint32_t));
+		printf ("Error:%s[%d] - lenght is not in multiple of %d\n",
+			__FUNCTION__, len, (uint32_t)sizeof(uint32_t));
 		return 0;
 	}
 
-- 
1.6.4.3



More information about the U-Boot mailing list