From ab8cee1b5e9a34731e59c052651d8d31e55f9825 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 19 Jan 2021 12:21:19 +0100 Subject: [PATCH] software/bios/cmds/cmd_i2c: Use "%zu" to format size_t The sizeof operator returns "size_t", which is defined to be "unsigned int" on 32-bit, and "unsigned long" on 64-bit. Format it using "%zu", to fix compiler warnings of the following type on 64-bit: warning: format '%d' expects argument of type 'int', but argument has type 'long unsigned int' [-Wformat=] Signed-off-by: Geert Uytterhoeven --- litex/soc/software/bios/cmds/cmd_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litex/soc/software/bios/cmds/cmd_i2c.c b/litex/soc/software/bios/cmds/cmd_i2c.c index 2319f3762..0e294397d 100644 --- a/litex/soc/software/bios/cmds/cmd_i2c.c +++ b/litex/soc/software/bios/cmds/cmd_i2c.c @@ -40,7 +40,7 @@ static void i2c_write_handler(int nb_params, char **params) } if (nb_params - 1 > sizeof(write_params)) { - printf("Max data length is %d", sizeof(write_params)); + printf("Max data length is %zu", sizeof(write_params)); return; } @@ -98,7 +98,7 @@ static void i2c_read_handler(int nb_params, char **params) return; } if (len > sizeof(buf)) { - printf("Max data count is %d", sizeof(buf)); + printf("Max data count is %zu", sizeof(buf)); return; }