media: staging: tegra-vde: print long unsigned using %lu format specifier

Message ID 20181108110224.1916-1-colin.king@canonical.com
State New
Headers show
Series
  • media: staging: tegra-vde: print long unsigned using %lu format specifier
Related show

Commit Message

Colin King Nov. 8, 2018, 11:02 a.m.
From: Colin Ian King <colin.king@canonical.com>

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@canonical.com>
---
 drivers/staging/media/tegra-vde/tegra-vde.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Greg Kroah-Hartman Nov. 8, 2018, 11:20 a.m. | #1
On Thu, Nov 08, 2018 at 11:02:24AM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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]
> 
> Fixes: 42e764d05712 ("staging: tegravde: replace bit assignment with macro")
> Cc: Ioannis Valasakis <code@wizofe.uk>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  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 {
> -- 
> 2.19.1

Thanks for this, you beat me too it :)

greg k-h
Dmitry Osipenko Nov. 8, 2018, 11:39 a.m. | #2
On 08.11.2018 14:02, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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@canonical.com>
> ---
>  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 {
> 

Thanks,

Acked-by: Dmitry Osipenko <digetx@gmail.com>
Hans Verkuil Nov. 9, 2018, 2:32 p.m. | #3
On 11/08/18 12:02, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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@canonical.com>
> ---
>  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
Dmitry Osipenko Nov. 13, 2018, 4:52 p.m. | #4
On 09.11.2018 17:32, Hans Verkuil wrote:
> On 11/08/18 12:02, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> 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@canonical.com>
>> ---
>>  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?

Same on ARM32. Yes, it should be either %zu or "!!(frame->flags & FLAG_B_FRAME)".
Dmitry Osipenko Nov. 13, 2018, 5:12 p.m. | #5
On 13.11.2018 19:52, Dmitry Osipenko wrote:
> On 09.11.2018 17:32, Hans Verkuil wrote:
>> On 11/08/18 12:02, Colin King wrote:
>>> From: Colin Ian King <colin.king@canonical.com>
>>>
>>> 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@canonical.com>
>>> ---
>>>  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?
> 
> Same on ARM32. Yes, it should be either %zu or "!!(frame->flags & FLAG_B_FRAME)".
> 

Actually this not a problem with a more recent -next. My bad, sorry for the noise. 

Probably I should try again with a "trace points" patch that removes those debug messages.

Patch

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 {