From: York Sun <york.sun@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH v5 2/4] sandbox: Fix compiling warning
Date: Thu, 25 Feb 2016 14:36:17 -0800 [thread overview]
Message-ID: <1456439779-4792-3-git-send-email-york.sun@nxp.com> (raw)
In-Reply-To: <1456439779-4792-1-git-send-email-york.sun@nxp.com>
Fix the following compiling warning. Some only occur on 32-bit hosts
disk/part_efi.c: In function 'alloc_read_gpt_entries':
disk/part_efi.c:894:2: warning: format '%zu' expects argument of
type 'size_t', but argument 5 has type 'long unsigned int'
[-Wformat]
disk/part_efi.c:907:4: warning: format '%zX' expects argument of
type 'size_t', but argument 3 has type 'long unsigned int'
[-Wformat]
cmd/lzmadec.c: In function 'do_lzmadec':
cmd/lzmadec.c:39:12: warning: passing argument 2 of
'lzmaBuffToBuffDecompress' from incompatible pointer type
[enabled by default]
include/lzma/../../lib/lzma/LzmaTools.h:17:12: note: expected
'SizeT *' but argument is of type 'long unsigned int *'
lib/hashtable.c: In function 'hexport_r':
lib/hashtable.c:605:2: warning: format '%zu' expects argument of
type 'size_t', but argument 5 has type 'long unsigned int'
[-Wformat]
lib/hashtable.c:661:5: warning: format '%zu' expects argument of
type 'size_t', but argument 2 has type 'long unsigned int'
[-Wformat]
lib/hashtable.c:661:5: warning: format '%zu' expects argument of
type 'size_t', but argument 3 has type 'long unsigned int'
[-Wformat]
lib/hashtable.c: In function 'himport_r':
lib/hashtable.c:793:3: warning: format '%zu' expects argument of
type 'size_t', but argument 2 has type 'long unsigned int'
[-Wformat]
Signed-off-by: York Sun <york.sun@nxp.com>
---
Changes in v5:
Revise commit message
Drop % sign in PRIpa macro
Use %#08llx instead of %08llx when applicable
Changes in v4:
New patch to fix compiling warnings for sandbox built on 32-bit host
Still need to change CONFIG_SANDBOX_BITS_PER_LONG to 32 to avoid
these warnings
include/asm-generic/bitops/__fls.h:17:2: warning: left shift
count >= width of type [enabled by default]
include/asm-generic/bitops/__fls.h:19:3: warning: left shift
count >= width of type [enabled by default]
include/asm-generic/bitops/__fls.h:22:2: warning: left shift
count >= width of type [enabled by default]
include/asm-generic/bitops/__fls.h:26:2: warning: left shift
count >= width of type [enabled by default]
include/asm-generic/bitops/__fls.h:30:2: warning: left shift
count >= width of type [enabled by default]
include/asm-generic/bitops/__fls.h:34:2: warning: left shift
count >= width of type [enabled by default]
include/asm-generic/bitops/__fls.h:38:2: warning: left shift
count >= width of type [enabled by default]
Changes in v3: None
Changes in v2: None
arch/sandbox/cpu/cpu.c | 3 ++-
arch/sandbox/include/asm/types.h | 9 +++++++--
arch/sandbox/lib/bootm.c | 3 ++-
arch/sandbox/lib/pci_io.c | 2 +-
cmd/lzmadec.c | 5 +++--
disk/part_efi.c | 2 +-
lib/hashtable.c | 2 +-
7 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index 196f3e1..5220b08 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -62,7 +62,8 @@ void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
map_dev = NULL;
if (enable_pci_map && !pci_map_physmem(paddr, &len, &map_dev, &ptr)) {
if (plen != len) {
- printf("%s: Warning: partial map at %x, wanted %lx, got %lx\n",
+ printf("%s: Warning: partial map at %" PRIpa
+ ", wanted %lx, got %lx\n",
__func__, paddr, len, plen);
}
map_len = len;
diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h
index 42c09e2..11b521d 100644
--- a/arch/sandbox/include/asm/types.h
+++ b/arch/sandbox/include/asm/types.h
@@ -53,8 +53,13 @@ typedef __UINT64_TYPE__ u64;
#define BITS_PER_LONG CONFIG_SANDBOX_BITS_PER_LONG
typedef unsigned long dma_addr_t;
-typedef u32 phys_addr_t;
-typedef u32 phys_size_t;
+#if defined(CONFIG_PHYS_64BIT) || (BITS_PER_LONG > 32)
+/* To be consistent with print format %llx */
+typedef unsigned long long phys_addr_t;
+#else
+typedef unsigned long phys_addr_t;
+#endif
+typedef unsigned long phys_size_t;
#endif /* __KERNEL__ */
diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c
index d49c927..2c15883 100644
--- a/arch/sandbox/lib/bootm.c
+++ b/arch/sandbox/lib/bootm.c
@@ -54,7 +54,8 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
{
if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
bootstage_mark(BOOTSTAGE_ID_RUN_OS);
- printf("## Transferring control to Linux (at address %08lx)...\n",
+ printf("## Transferring control to Linux (at address %#08" PRIpa
+ ")...\n",
images->ep);
reset_cpu(0);
}
diff --git a/arch/sandbox/lib/pci_io.c b/arch/sandbox/lib/pci_io.c
index 0de124f..f79ea0a 100644
--- a/arch/sandbox/lib/pci_io.c
+++ b/arch/sandbox/lib/pci_io.c
@@ -35,7 +35,7 @@ int pci_map_physmem(phys_addr_t paddr, unsigned long *lenp,
return 0;
}
- debug("%s: failed: addr=%x\n", __func__, paddr);
+ debug("%s: failed: addr=%" PRIpa "\n", __func__, paddr);
return -ENOSYS;
}
diff --git a/cmd/lzmadec.c b/cmd/lzmadec.c
index 1ad9ed6..8e370ef 100644
--- a/cmd/lzmadec.c
+++ b/cmd/lzmadec.c
@@ -20,7 +20,7 @@
static int do_lzmadec(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
unsigned long src, dst;
- unsigned long src_len = ~0UL, dst_len = ~0UL;
+ SizeT src_len = ~0UL, dst_len = ~0UL;
int ret;
switch (argc) {
@@ -40,7 +40,8 @@ static int do_lzmadec(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
if (ret != SZ_OK)
return 1;
- printf("Uncompressed size: %ld = 0x%lX\n", src_len, src_len);
+ printf("Uncompressed size: %ld = 0x%lX\n",
+ (ulong)src_len, (ulong)src_len);
setenv_hex("filesize", src_len);
return 0;
diff --git a/disk/part_efi.c b/disk/part_efi.c
index e1b58c5..a59527b 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -10,7 +10,6 @@
* when CONFIG_SYS_64BIT_LBA is not defined, lbaint_t is 32 bits; this
* limits the maximum size of addressable storage to < 2 Terra Bytes
*/
-#include <asm/unaligned.h>
#include <common.h>
#include <command.h>
#include <ide.h>
@@ -19,6 +18,7 @@
#include <memalign.h>
#include <part_efi.h>
#include <linux/ctype.h>
+#include <asm/unaligned.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/lib/hashtable.c b/lib/hashtable.c
index 02b4105..6cd076d 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -13,6 +13,7 @@
* SPDX-License-Identifier: LGPL-2.1+
*/
+#include <common.h>
#include <errno.h>
#include <malloc.h>
@@ -29,7 +30,6 @@
# endif
# endif
#else /* U-Boot build */
-# include <common.h>
# include <linux/string.h>
# include <linux/ctype.h>
#endif
--
1.7.9.5
next prev parent reply other threads:[~2016-02-25 22:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 22:36 [U-Boot] [RFC PATCH v5 0/4] Enable FIT image to be loaded beyond 32-bit space York Sun
2016-02-25 22:36 ` [U-Boot] [RFC PATCH v5 1/4] common: Convert ulong to phys_addr_t for image addresses York Sun
2016-02-25 23:05 ` Wolfgang Denk
2016-02-26 17:22 ` york sun
2016-02-26 17:31 ` Simon Glass
2016-02-26 17:47 ` york sun
2016-02-26 18:05 ` Simon Glass
2016-02-26 18:09 ` york sun
2016-02-25 22:36 ` York Sun [this message]
2016-02-25 22:36 ` [U-Boot] [RFC PATCH v5 3/4] common: image-fit: Use a common function to get address York Sun
2016-02-25 22:36 ` [U-Boot] [RFC PATCH v5 4/4] common: image-fit: Fix load and entry addresses in FIT image York Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1456439779-4792-3-git-send-email-york.sun@nxp.com \
--to=york.sun@nxp.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox