Patchwork [mtd-utils] flash_otp_write: fix format string warning

login
register
mail settings
Submitter Uwe Kleine-König
Date Feb. 20, 2013, 4:41 p.m.
Message ID <1361378469-18631-1-git-send-email-u.kleine-koenig@pengutronix.de>
Download mbox | patch
Permalink /patch/222117/
State New
Headers show

Comments

Uwe Kleine-König - Feb. 20, 2013, 4:41 p.m.
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(-)
Artem Bityutskiy - March 6, 2013, 9:19 a.m.
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.

Patch

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;