diff mbox

[v2] flash_otp_write: fix format string warning

Message ID 1362563020-14003-1-git-send-email-u.kleine-koenig@pengutronix.de
State New, archived
Headers show

Commit Message

Uwe Kleine-König March 6, 2013, 9:43 a.m. UTC
This fixes
	flash_otp_write.c: In function 'main':
	flash_otp_write.c:61:2: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' [-Wformat]

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---

Notes:
    Changes since (implicit) v1, sent with
    Message-Id: <1361378469-18631-1-git-send-email-u.kleine-koenig@pengutronix.de>:
    
     - Use PRIdoff_t helper as suggested by Artem

 flash_otp_write.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Artem Bityutskiy March 6, 2013, 11:10 a.m. UTC | #1
On Wed, 2013-03-06 at 10:43 +0100, Uwe Kleine-König wrote:
> This fixes
> 	flash_otp_write.c: In function 'main':
> 	flash_otp_write.c:61:2: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' [-Wformat]
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Wait, sorry, I did not notice this at first, but I see that this is
already fixed by this commit:

commit f3f3a208048eac5f8b5752a17ebcd44db9230fd8
Author: Richard Genoud <richard.genoud@gmail.com>
Date:   Wed Sep 12 16:38:34 2012 +0200

    consistency between u_int32_t / off_t / off64_t
    
    We should use the off_t type instead of off64_t or u_int32_t as its
    length is controlled by the WITHOUT_LARGEFILE flag.
    
    Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
diff mbox

Patch

diff --git a/flash_otp_write.c b/flash_otp_write.c
index d407ebb..f360a3e 100644
--- a/flash_otp_write.c
+++ b/flash_otp_write.c
@@ -15,6 +15,8 @@ 
 
 #include <mtd/mtd-user.h>
 
+#include "common.h"
+
 int main(int argc,char *argv[])
 {
 	int fd, val, ret, size, wrote, len;
@@ -58,7 +60,8 @@  int main(int argc,char *argv[])
 		return errno;
 	}
 
-	printf("Writing OTP user data on %s at offset 0x%lx\n", argv[2], offset);
+	printf("Writing OTP user data on %s at offset 0x%" PRIdoff_t "\n",
+			argv[2], offset);
 
 	if (mtdInfo.type == MTD_NANDFLASH)
 		len = mtdInfo.writesize;