[PATCH] drm/vblank: Fix -Wformat compile warnings on some arches

Thomas Zimmermann tzimmermann at suse.de
Fri May 22 06:30:30 UTC 2020



Am 21.05.20 um 22:46 schrieb Lyude Paul:
> On some architectures like ppc64le and aarch64, compiling with
> -Wformat=1 will throw the following warnings:
> 
>   In file included from drivers/gpu/drm/drm_vblank.c:33:
>   drivers/gpu/drm/drm_vblank.c: In function 'drm_update_vblank_count':
>   drivers/gpu/drm/drm_vblank.c:273:16: warning: format '%llu' expects
>   argument of type 'long long unsigned int', but argument 4 has type
>   'long int' [-Wformat=]
>     DRM_DEBUG_VBL("updating vblank count on crtc %u:"
>                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   ./include/drm/drm_print.h:407:22: note: in definition of macro
>   'DRM_DEBUG_VBL'
>     drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS__)
>                         ^~~
>   drivers/gpu/drm/drm_vblank.c:274:22: note: format string is defined here
>            " current=%llu, diff=%u, hw=%u hw_last=%u\n",
>                      ~~~^
>                      %lu
> 
> So, fix that with a typecast.
> 
> Signed-off-by: Lyude Paul <lyude at redhat.com>
> Co-developed-by: Dave Airlie <airlied at redhat.com>

Reviewed-by: Thomas Zimmermann <tzimmermann at suse.de>

Thanks!

> ---
>  drivers/gpu/drm/drm_vblank.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index acb3c3f65b579..1a96db2dd16fa 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -342,7 +342,7 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,
>  
>  	DRM_DEBUG_VBL("updating vblank count on crtc %u:"
>  		      " current=%llu, diff=%u, hw=%u hw_last=%u\n",
> -		      pipe, atomic64_read(&vblank->count), diff,
> +		      pipe, (unsigned long long)atomic64_read(&vblank->count), diff,
>  		      cur_vblank, vblank->last);
>  
>  	if (diff == 0) {
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200522/f3321402/attachment-0001.sig>


More information about the dri-devel mailing list