Re: [PATCH] media: staging: tegra-vde: print long unsigned using %lu format specifier

From: Hans Verkuil
Date: Fri Nov 09 2018 - 09:32:54 EST


On 11/08/18 12:02, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> The frame.flags & FLAG_B_FRAME is promoted to a long unsigned because
> of the use of the BIT() macro when defining FLAG_B_FRAME and causing a
> build warning. Fix this by using the %lu format specifer.
>
> Cleans up warning:
> drivers/staging/media/tegra-vde/tegra-vde.c:267:5: warning: format
> specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
>
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> ---
> drivers/staging/media/tegra-vde/tegra-vde.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/tegra-vde/tegra-vde.c b/drivers/staging/media/tegra-vde/tegra-vde.c
> index 6f06061a40d9..66cf14212c14 100644
> --- a/drivers/staging/media/tegra-vde/tegra-vde.c
> +++ b/drivers/staging/media/tegra-vde/tegra-vde.c
> @@ -262,7 +262,7 @@ static void tegra_vde_setup_iram_tables(struct tegra_vde *vde,
> value |= frame->frame_num;
>
> dev_dbg(vde->miscdev.parent,
> - "\tFrame %d: frame_num = %d B_frame = %d\n",
> + "\tFrame %d: frame_num = %d B_frame = %lu\n",
> i + 1, frame->frame_num,
> (frame->flags & FLAG_B_FRAME));
> } else {
>

Compiling for i686 gives:

In file included from /home/hans/work/build/media-git/include/linux/printk.h:336,
from /home/hans/work/build/media-git/include/linux/kernel.h:14,
from /home/hans/work/build/media-git/include/linux/clk.h:16,
from /home/hans/work/build/media-git/drivers/staging/media/tegra-vde/tegra-vde.c:12:
/home/hans/work/build/media-git/drivers/staging/media/tegra-vde/tegra-vde.c: In function 'tegra_vde_setup_iram_tables':
/home/hans/work/build/media-git/drivers/staging/media/tegra-vde/tegra-vde.c:265:5: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'u32' {aka 'unsigned int'} [-Wformat=]
"\tFrame %d: frame_num = %d B_frame = %lu\n",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/hans/work/build/media-git/include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
__dynamic_dev_dbg(&descriptor, dev, fmt, \
^~~
/home/hans/work/build/media-git/include/linux/device.h:1463:23: note: in expansion of macro 'dev_fmt'
dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~~~~~
/home/hans/work/build/media-git/drivers/staging/media/tegra-vde/tegra-vde.c:264:4: note: in expansion of macro 'dev_dbg'
dev_dbg(vde->miscdev.parent,
^~~~~~~

Should it be %zu?

Regards,

Hans