Skip to contentSkip to conversation

env_onenand compiler warning

U-Boot New Dirk Behme 4 participants 4 messages Jul 19, 2009 – Jul 20, 2009

lore
Share & tools
lore

Dirk Behme

author
#0 lore raw

Testing recent mainline git head for omap3_evm_config I get compiler warning

env_onenand.c: In function 'saveenv':
env_onenand.c:104: warning: format '%08lx' expects type 'long unsigned int', but argument 2 has type 'loff_t'

Is there already a fix available?

Thanks

Dirk

#1 lore raw

PATCH 1/1 env_onenand: fix compiler warning for error message

From: Alessandro Rubini <[email protected]>

Since env_addr is a loff_t (long long), "%08lx" is not a good format; this uses "%08llx" (not "%016llx"), to get 8 or more hex digits. I tnknk padding to 8 digits makes things more readable for "small" numbers, and the unlikely values over 4GB are reported correctly anyways.

---

I found this during "./MAKEALL arm", and it affects my nhk8815 as well. The warning was already reported today by Dirk Behme, thus this is reply to his message.

 common/env_onenand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/env_onenand.c +1 -1
index 476fdbc..0b03537 100644
@@ -101,7 +101,7 @@ int saveenv(void)
 	instr.addr = env_addr;
 	instr.mtd = mtd;
 	if (mtd->erase(mtd, &instr)) {
-		printf("OneNAND: erase failed at 0x%08lx\n", env_addr);
+		printf("OneNAND: erase failed at 0x%08llx\n", (u64)env_addr);
 		return 1;
 	}
 
Signature · 1 line
1.6.0.2
#2 lore raw

PATCH 1/1 env_onenand: fix compiler warning for error message

Dear Alessandro Rubini,

Quoted 7 lines · In message <[email protected]> you wrote:

From: Alessandro Rubini <[email protected]>

Since env_addr is a loff_t (long long), "%08lx" is not a good format; this uses "%08llx" (not "%016llx"), to get 8 or more hex digits. I tnknk padding to 8 digits makes things more readable for "small" numbers, and the unlikely values over 4GB are reported correctly anyways.

But %llx needs CONFIG_SYS_64BIT_VSPRINTF - are we sure that this is #define'd on all boards that use onenand?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"In the face of entropy and nothingness, you kind of have to  pretend
it's  not  there  if  you  want  to  keep writing good code."
- Karl Lehenbauer
#3 lore raw
In reply to Dirk Behme

Hi,

Thank you for pointing compiler warning.

I post the patch.

Thank you,
Kyungmin Park

Quoted 18 lines · Dirk Behme

Testing recent mainline git head for omap3_evm_config I get compiler warning

env_onenand.c: In function 'saveenv':
env_onenand.c:104: warning: format '%08lx' expects type 'long unsigned int', but argument 2 has type 'loff_t'

Is there already a fix available?

Thanks

Dirk
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot