Commit e48f3741c357246c78aa367bbd56fe2684f7bf8d
1 parent
85bafb6da4
Exists in
v2017.01-smarct4x
and in
37 other branches
sandbox: Fix warnings due to 64-bit printf() strings
Now that we have inttypes.h, use it in a few more places to avoid compiler warnings on sandbox when building on 64-bit machines. Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 3 changed files with 22 additions and 20 deletions Side-by-side Diff
common/cmd_mem.c
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | #include <dataflash.h> |
20 | 20 | #endif |
21 | 21 | #include <hash.h> |
22 | +#include <inttypes.h> | |
22 | 23 | #include <watchdog.h> |
23 | 24 | #include <asm/io.h> |
24 | 25 | #include <linux/compiler.h> |
... | ... | @@ -338,7 +339,8 @@ |
338 | 339 | if (word1 != word2) { |
339 | 340 | ulong offset = buf1 - base; |
340 | 341 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
341 | - printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n", | |
342 | + printf("%s at 0x%p (%#0*"PRIx64") != %s at 0x%p (%#0*" | |
343 | + PRIx64 ")\n", | |
342 | 344 | type, (void *)(addr1 + offset), size, word1, |
343 | 345 | type, (void *)(addr2 + offset), size, word2); |
344 | 346 | #else |
... | ... | @@ -1146,7 +1148,7 @@ |
1146 | 1148 | printf(" %08x", *((u32 *)ptr)); |
1147 | 1149 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1148 | 1150 | else if (size == 8) |
1149 | - printf(" %016llx", *((u64 *)ptr)); | |
1151 | + printf(" %016" PRIx64, *((u64 *)ptr)); | |
1150 | 1152 | #endif |
1151 | 1153 | else if (size == 2) |
1152 | 1154 | printf(" %04x", *((u16 *)ptr)); |
common/fdt_support.c
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | */ |
9 | 9 | |
10 | 10 | #include <common.h> |
11 | +#include <inttypes.h> | |
11 | 12 | #include <stdio_dev.h> |
12 | 13 | #include <linux/ctype.h> |
13 | 14 | #include <linux/types.h> |
... | ... | @@ -914,8 +915,6 @@ |
914 | 915 | fdt_delprop(blob, off, alias); |
915 | 916 | } |
916 | 917 | |
917 | -#define PRu64 "%llx" | |
918 | - | |
919 | 918 | /* Max address size we deal with */ |
920 | 919 | #define OF_MAX_ADDR_CELLS 4 |
921 | 920 | #define OF_BAD_ADDR ((u64)-1) |
... | ... | @@ -973,8 +972,8 @@ |
973 | 972 | s = of_read_number(range + na + pna, ns); |
974 | 973 | da = of_read_number(addr, na); |
975 | 974 | |
976 | - debug("OF: default map, cp="PRu64", s="PRu64", da="PRu64"\n", | |
977 | - cp, s, da); | |
975 | + debug("OF: default map, cp=%" PRIu64 ", s=%" PRIu64 | |
976 | + ", da=%" PRIu64 "\n", cp, s, da); | |
978 | 977 | |
979 | 978 | if (da < cp || da >= (cp + s)) |
980 | 979 | return OF_BAD_ADDR; |
... | ... | @@ -1052,7 +1051,7 @@ |
1052 | 1051 | |
1053 | 1052 | finish: |
1054 | 1053 | of_dump_addr("OF: parent translation for:", addr, pna); |
1055 | - debug("OF: with offset: "PRu64"\n", offset); | |
1054 | + debug("OF: with offset: %" PRIu64 "\n", offset); | |
1056 | 1055 | |
1057 | 1056 | /* Translate it into parent bus space */ |
1058 | 1057 | return pbus->translate(addr, offset, pna); |
... | ... | @@ -1381,9 +1380,9 @@ |
1381 | 1380 | |
1382 | 1381 | dt_addr = fdt_translate_address(fdt, node, reg); |
1383 | 1382 | if (addr != dt_addr) { |
1384 | - printf("Warning: U-Boot configured device %s at address %llx,\n" | |
1385 | - " but the device tree has it address %llx.\n", | |
1386 | - alias, addr, dt_addr); | |
1383 | + printf("Warning: U-Boot configured device %s at address %" | |
1384 | + PRIx64 ",\n but the device tree has it address %" | |
1385 | + PRIx64 ".\n", alias, addr, dt_addr); | |
1387 | 1386 | return 0; |
1388 | 1387 | } |
1389 | 1388 |
disk/part_efi.c
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | #include <common.h> |
15 | 15 | #include <command.h> |
16 | 16 | #include <ide.h> |
17 | +#include <inttypes.h> | |
17 | 18 | #include <malloc.h> |
18 | 19 | #include <part_efi.h> |
19 | 20 | #include <linux/ctype.h> |
20 | 21 | |
21 | 22 | |
22 | 23 | |
... | ... | @@ -553,28 +554,28 @@ |
553 | 554 | |
554 | 555 | /* Check that the my_lba entry points to the LBA that contains the GPT */ |
555 | 556 | if (le64_to_cpu(pgpt_head->my_lba) != lba) { |
556 | - printf("GPT: my_lba incorrect: %llX != %llX\n", | |
557 | - le64_to_cpu(pgpt_head->my_lba), | |
558 | - lba); | |
557 | + printf("GPT: my_lba incorrect: %llX != %" PRIX64 "\n", | |
558 | + le64_to_cpu(pgpt_head->my_lba), | |
559 | + lba); | |
559 | 560 | return 0; |
560 | 561 | } |
561 | 562 | |
562 | 563 | /* Check the first_usable_lba and last_usable_lba are within the disk. */ |
563 | 564 | lastlba = (u64)dev_desc->lba; |
564 | 565 | if (le64_to_cpu(pgpt_head->first_usable_lba) > lastlba) { |
565 | - printf("GPT: first_usable_lba incorrect: %llX > %llX\n", | |
566 | - le64_to_cpu(pgpt_head->first_usable_lba), lastlba); | |
566 | + printf("GPT: first_usable_lba incorrect: %llX > %" PRIX64 "\n", | |
567 | + le64_to_cpu(pgpt_head->first_usable_lba), lastlba); | |
567 | 568 | return 0; |
568 | 569 | } |
569 | 570 | if (le64_to_cpu(pgpt_head->last_usable_lba) > lastlba) { |
570 | - printf("GPT: last_usable_lba incorrect: %llX > %llX\n", | |
571 | - le64_to_cpu(pgpt_head->last_usable_lba), lastlba); | |
571 | + printf("GPT: last_usable_lba incorrect: %llX > %" PRIX64 "\n", | |
572 | + le64_to_cpu(pgpt_head->last_usable_lba), lastlba); | |
572 | 573 | return 0; |
573 | 574 | } |
574 | 575 | |
575 | - debug("GPT: first_usable_lba: %llX last_usable_lba %llX last lba %llX\n", | |
576 | - le64_to_cpu(pgpt_head->first_usable_lba), | |
577 | - le64_to_cpu(pgpt_head->last_usable_lba), lastlba); | |
576 | + debug("GPT: first_usable_lba: %llX last_usable_lba %llX last lba %" | |
577 | + PRIX64 "\n", le64_to_cpu(pgpt_head->first_usable_lba), | |
578 | + le64_to_cpu(pgpt_head->last_usable_lba), lastlba); | |
578 | 579 | |
579 | 580 | /* Read and allocate Partition Table Entries */ |
580 | 581 | *pgpt_pte = alloc_read_gpt_entries(dev_desc, pgpt_head); |