public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH mtd-utils] flash_otp_write: fix format string warning
@ 2013-02-20 16:41 Uwe Kleine-König
  2013-03-06  9:19 ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2013-02-20 16:41 UTC (permalink / raw)
  To: linux-mtd, Artem Bityutskiy; +Cc: kernel

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>
---
 flash_otp_write.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flash_otp_write.c b/flash_otp_write.c
index d407ebb..41cf1c5 100644
--- a/flash_otp_write.c
+++ b/flash_otp_write.c
@@ -58,7 +58,7 @@ 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%lx\n", argv[2], (unsigned long)offset);
 
 	if (mtdInfo.type == MTD_NANDFLASH)
 		len = mtdInfo.writesize;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH mtd-utils] flash_otp_write: fix format string warning
  2013-02-20 16:41 [PATCH mtd-utils] flash_otp_write: fix format string warning Uwe Kleine-König
@ 2013-03-06  9:19 ` Artem Bityutskiy
  2013-03-06  9:43   ` [PATCH v2] " Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Artem Bityutskiy @ 2013-03-06  9:19 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: linux-mtd, kernel

On Wed, 2013-02-20 at 17:41 +0100, Uwe Kleine-König wrote:
> diff --git a/flash_otp_write.c b/flash_otp_write.c
> index d407ebb..41cf1c5 100644
> --- a/flash_otp_write.c
> +++ b/flash_otp_write.c
> @@ -58,7 +58,7 @@ 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%lx\n", argv[2], (unsigned long)offset);

Thanks for the clean-up, but I think last time we discussed this we
agreed to use the new C99 "PRIx64" stuff, and introduced a helper
PRIdoff_t helper which we use for 'off_t' printing. See commit
56840a198a70604ece50d9d727cebcc28930ab4c for example.

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] flash_otp_write: fix format string warning
  2013-03-06  9:19 ` Artem Bityutskiy
@ 2013-03-06  9:43   ` Uwe Kleine-König
  2013-03-06 11:10     ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2013-03-06  9:43 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd, kernel

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(-)

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;
-- 
1.8.2.rc2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] flash_otp_write: fix format string warning
  2013-03-06  9:43   ` [PATCH v2] " Uwe Kleine-König
@ 2013-03-06 11:10     ` Artem Bityutskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2013-03-06 11:10 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: linux-mtd, kernel

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>

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-06 11:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-20 16:41 [PATCH mtd-utils] flash_otp_write: fix format string warning Uwe Kleine-König
2013-03-06  9:19 ` Artem Bityutskiy
2013-03-06  9:43   ` [PATCH v2] " Uwe Kleine-König
2013-03-06 11:10     ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox