mtd: spi: sf_dataflash.c: Make use of 'z' for printing size_t
PATCH 1/1 mtd: spi: sf_dataflash.c: Make use of 'z' for printing size_t
When printing the contents of an size_t variable we need to use z prefix to the format character in order to get the correct format type depending on 32 or 64bit-ness.
Signed-off-by Tom Rini <[email protected]>
--- drivers/mtd/spi/sf_dataflash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/spi/sf_dataflash.c +4 -4
@@ -138,11 +138,11 @@ static int spi_dataflash_erase(struct udevice *dev, u32 offset, size_t len)memset (dataflash->command,0 ,sizeof (dataflash->command)); command = dataflash->command; -debug ("%s: erase addr=0x%x len 0x%x\n" , dev->name, offset, len); +debug ("%s: erase addr=0x%x len 0x%zx\n" , dev->name, offset, len);div_u64_rem (len, spi_flash->page_size, &rem);if (rem) { -printf ("%s: len(0x%x) isn't the multiple of page size(0x%x)\n" , +printf ("%s: len(0x%zx) isn't the multiple of page size(0x%x)\n" , dev->name, len, spi_flash->page_size);return -EINVAL ; }
@@ -229,7 +229,7 @@ static int spi_dataflash_read(struct udevice *dev, u32 offset, size_t len,memset (dataflash->command,0 ,sizeof (dataflash->command)); command = dataflash->command; -debug ("%s: erase addr=0x%x len 0x%x\n" , dev->name, offset, len); +debug ("%s: erase addr=0x%x len 0x%zx\n" , dev->name, offset, len);debug ("READ: (%x) %x %x %x\n" , command[0 ], command[1 ], command[2 ], command[3 ]);
@@ -287,7 +287,7 @@ int spi_dataflash_write(struct udevice *dev, u32 offset, size_t len,memset (dataflash->command,0 ,sizeof (dataflash->command)); command = dataflash->command; -debug ("%s: write 0x%x..0x%x\n" , dev->name, offset, (offset + len)); +debug ("%s: write 0x%x..0x%zx\n" , dev->name, offset, (offset + len)); pageaddr = ((unsigned )offset / spi_flash->page_size); to = ((unsigned )offset % spi_flash->page_size);
Signature · 1 line
2.43.0
Quoted 5 lines · Tom Rini
When printing the contents of an
size_tvariable we need to use z prefix to the format character in order to get the correct format type depending on 32 or 64bit-ness.
Applied to u-boot/master, thanks!
[1/1] mtd: spi: sf_dataflash.c: Make use of 'z' for printing size_t
commit: ba05f1a8d7d8f2d4f7ff244dfc29c1a7b87477d6
Signature · 1 line
Tom