diff mbox

[U-Boot,PATCH/RFC] fix several printf() modifiers

Message ID 1323857047-11574-1-git-send-email-andreas.devel@googlemail.com
State Superseded
Headers show

Commit Message

Andreas Bießmann Dec. 14, 2011, 10:04 a.m. UTC
From: Andreas Bießmann <biessmann@corscience.de>

Some architectures define size_t to unsigned long even though they are 32 bit
architectures.

This patch fixes several warnings when running MAKEALL for avr32 architecture:

---8<---
mmu.c: In function 'mmu_init_r':
mmu.c:25: warning: format '%08x' expects type 'unsigned int', but argument 2 has type 'uintptr_t'
fat.c: In function 'do_fat_read':
fat.c:879: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int'
cmd_sf.c: In function 'spi_flash_update_block':
cmd_sf.c:130: warning: format '%#x' expects type 'unsigend int', but argument 4 has type 'size_t'
cmd_sf.c:135: warning: format '%x' expects type 'unsigned int', but argument 3 has type 'size_t'
--->8---

Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
cc: Mike Frysinger <vapier@gentoo.org>
cc: Thomas Chou <thomas@wytron.com.tw>
---
 arch/avr32/cpu/at32ap700x/mmu.c |    2 +-
 common/cmd_sf.c                 |    4 ++--
 fs/fat/fat.c                    |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Comments

Thomas Chou Dec. 15, 2011, 2:22 a.m. UTC | #1
On 12/14/2011 06:04 PM, Andreas Bießmann wrote:
> From: Andreas Bießmann<biessmann@corscience.de>
>
> Some architectures define size_t to unsigned long even though they are 32 bit
> architectures.
>
> This patch fixes several warnings when running MAKEALL for avr32 architecture:

Hi Andreas,

Thanks. I have tested cmd_sf and fat.

Tested-by: Thomas Chou <thomas@wytron.com.tw>

I would suggest splitting this patch into three, as they related to 
different custodians.

Best regards,
Thomas
Graeme Russ Dec. 15, 2011, 2:39 a.m. UTC | #2
Hi Thomas,

On Dec 15, 2011 1:22 PM, "Thomas Chou" <thomas@wytron.com.tw> wrote:
>
> On 12/14/2011 06:04 PM, Andreas Bießmann wrote:
>>
>> From: Andreas Bießmann<biessmann@corscience.de>
>>
>> Some architectures define size_t to unsigned long even though they are
32 bit
>> architectures.
>>
>> This patch fixes several warnings when running MAKEALL for avr32
architecture:
>
>
> Hi Andreas,
>
> Thanks. I have tested cmd_sf and fat.
>
> Tested-by: Thomas Chou <thomas@wytron.com.tw>
>
> I would suggest splitting this patch into three, as they related to
different custodians.

No, that is not true - the patch is a single logical unit

The three maintainers can each provide an Ack

Regards,

Graeme
Mike Frysinger Dec. 15, 2011, 5:35 a.m. UTC | #3
On Wednesday 14 December 2011 05:04:07 Andreas Bießmann wrote:
> --- a/arch/avr32/cpu/at32ap700x/mmu.c
> +++ b/arch/avr32/cpu/at32ap700x/mmu.c
>
> -	printf("VMR table @ 0x%08x\n", vmr_table_addr);
> +	printf("VMR table @ %#lx\n", vmr_table_addr);

this isn't the same.  probably should be %08lx.

> --- a/common/cmd_sf.c
> +++ b/common/cmd_sf.c
>
> -	debug("offset=%#x, sector_size=%#x, len=%#x\n",
> +	debug("offset=%#x, sector_size=%#x, len=%#zx\n",
>
> -		debug("Skip region %x size %x: no change\n",
> +		debug("Skip region %x size %zx: no change\n",
>
> --- a/fs/fat/fat.c
> +++ b/fs/fat/fat.c
> 
> -		debug("FAT read sect=%d, clust_size=%d, DIRENTSPERBLOCK=%d\n",
> +		debug("FAT read sect=%d, clust_size=%d, DIRENTSPERBLOCK=%zd\n",

these look good.
-mike
Mike Frysinger Dec. 15, 2011, 5:36 a.m. UTC | #4
On Wednesday 14 December 2011 21:39:48 Graeme Russ wrote:
> On Dec 15, 2011 1:22 PM, "Thomas Chou" wrote:
> > I would suggest splitting this patch into three, as they related to
> > different custodians.
> 
> No, that is not true - the patch is a single logical unit

meh.  no need to keep them as one.
-mike
Andreas Bießmann Dec. 15, 2011, 8:30 a.m. UTC | #5
Dear Mike Frysinger,

On 15.12.2011 06:35, Mike Frysinger wrote:
> On Wednesday 14 December 2011 05:04:07 Andreas Bießmann wrote:
>> --- a/arch/avr32/cpu/at32ap700x/mmu.c
>> +++ b/arch/avr32/cpu/at32ap700x/mmu.c
>>
>> -	printf("VMR table @ 0x%08x\n", vmr_table_addr);
>> +	printf("VMR table @ %#lx\n", vmr_table_addr);
> 
> this isn't the same.  probably should be %08lx.

You are right, but as you may know the memory map for at32ap7000 has its
SDRAM physically at 0x10000000. Therefore the result will be the same
for 0x%08lx and %#lx (in all currently available boards).
But maybe one will locate the vmr_table sometimes in SRAM some day?

I will provide v2 which change this back, split off in three patches and
add the respective custodian in cc.

best regards

Andreas Bießmann
Andreas Bießmann Dec. 15, 2011, 8:56 a.m. UTC | #6
From: Andreas Bießmann <biessmann@corscience.de>

Andreas Bießmann (3):
  cmd_sf.c: fix printf() length modifier
  fat.c: fix printf() length modifier
  avr32:mmu.c: fix printf() length modifier

 arch/avr32/cpu/at32ap700x/mmu.c |    2 +-
 common/cmd_sf.c                 |    4 ++--
 fs/fat/fat.c                    |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
Mike Frysinger Dec. 15, 2011, 7:22 p.m. UTC | #7
On Thursday 15 December 2011 03:30:37 Andreas Bießmann wrote:
> On 15.12.2011 06:35, Mike Frysinger wrote:
> > On Wednesday 14 December 2011 05:04:07 Andreas Bießmann wrote:
> >> --- a/arch/avr32/cpu/at32ap700x/mmu.c
> >> +++ b/arch/avr32/cpu/at32ap700x/mmu.c
> >> 
> >> -	printf("VMR table @ 0x%08x\n", vmr_table_addr);
> >> +	printf("VMR table @ %#lx\n", vmr_table_addr);
> > 
> > this isn't the same.  probably should be %08lx.
> 
> You are right, but as you may know the memory map for at32ap7000 has its
> SDRAM physically at 0x10000000. Therefore the result will be the same
> for 0x%08lx and %#lx (in all currently available boards).

i don't know anything about AVR32 ;)

> But maybe one will locate the vmr_table sometimes in SRAM some day?

seems safer, although probably unlikely as i think the AVR32 is pretty much 
dead nowadays ?
-mike
diff mbox

Patch

diff --git a/arch/avr32/cpu/at32ap700x/mmu.c b/arch/avr32/cpu/at32ap700x/mmu.c
index c3a1b93..fda06a9 100644
--- a/arch/avr32/cpu/at32ap700x/mmu.c
+++ b/arch/avr32/cpu/at32ap700x/mmu.c
@@ -22,7 +22,7 @@  void mmu_init_r(unsigned long dest_addr)
 	 */
 	vmr_table_addr = (uintptr_t)&mmu_vmr_table;
 	sysreg_write(PTBR, vmr_table_addr);
-	printf("VMR table @ 0x%08x\n", vmr_table_addr);
+	printf("VMR table @ %#lx\n", vmr_table_addr);
 
 	/* Enable paging */
 	sysreg_write(MMUCR, SYSREG_BF(DRP, 1) | SYSREG_BF(DLA, 1)
diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index 7225656..612fd18 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -127,12 +127,12 @@  static int do_spi_flash_probe(int argc, char * const argv[])
 static const char *spi_flash_update_block(struct spi_flash *flash, u32 offset,
 		size_t len, const char *buf, char *cmp_buf, size_t *skipped)
 {
-	debug("offset=%#x, sector_size=%#x, len=%#x\n",
+	debug("offset=%#x, sector_size=%#x, len=%#zx\n",
 		offset, flash->sector_size, len);
 	if (spi_flash_read(flash, offset, len, cmp_buf))
 		return "read";
 	if (memcmp(cmp_buf, buf, len) == 0) {
-		debug("Skip region %x size %x: no change\n",
+		debug("Skip region %x size %zx: no change\n",
 			offset, len);
 		*skipped += len;
 		return NULL;
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 9a29458..dbb8db9 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -876,7 +876,7 @@  do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
 	while (1) {
 		int i;
 
-		debug("FAT read sect=%d, clust_size=%d, DIRENTSPERBLOCK=%d\n",
+		debug("FAT read sect=%d, clust_size=%d, DIRENTSPERBLOCK=%zd\n",
 			cursect, mydata->clust_size, DIRENTSPERBLOCK);
 
 		if (disk_read(cursect,