* [PATCH] drm/vc4: use %z format string for size_t
@ 2017-11-02 11:20 Arnd Bergmann
2017-11-02 11:56 ` Boris Brezillon
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-11-02 11:20 UTC (permalink / raw)
To: Eric Anholt, David Airlie
Cc: Arnd Bergmann, Boris Brezillon, Daniel Vetter, Cihangir Akturk,
Dave Airlie, dri-devel, linux-kernel
Printing a size_t variable needs to use the %z format string modifier
rather than %l, otherwise we get this warning on 64-bit architectures:
drivers/gpu/drm/vc4/vc4_bo.c: In function 'vc4_bo_stats_debugfs':
drivers/gpu/drm/vc4/vc4_bo.c:91:26: error: format '%d' expects argument of type 'int', but argument 4 has type 'size_t {aka long unsigned int}' [-Werror=format=]
Fixes: b9f19259b84d ("drm/vc4: Add the DRM_IOCTL_VC4_GEM_MADVISE ioctl")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpu/drm/vc4/vc4_bo.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
index 3c3d11236910..4ae45d7dac42 100644
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -88,11 +88,11 @@ int vc4_bo_stats_debugfs(struct seq_file *m, void *unused)
mutex_lock(&vc4->purgeable.lock);
if (vc4->purgeable.num)
- seq_printf(m, "%30s: %6dkb BOs (%d)\n", "userspace BO cache",
+ seq_printf(m, "%30s: %6zdkb BOs (%d)\n", "userspace BO cache",
vc4->purgeable.size / 1024, vc4->purgeable.num);
if (vc4->purgeable.purged_num)
- seq_printf(m, "%30s: %6dkb BOs (%d)\n", "total purged BO",
+ seq_printf(m, "%30s: %6zdkb BOs (%d)\n", "total purged BO",
vc4->purgeable.purged_size / 1024,
vc4->purgeable.purged_num);
mutex_unlock(&vc4->purgeable.lock);
--
2.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/vc4: use %z format string for size_t
2017-11-02 11:20 [PATCH] drm/vc4: use %z format string for size_t Arnd Bergmann
@ 2017-11-02 11:56 ` Boris Brezillon
0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2017-11-02 11:56 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Eric Anholt, David Airlie, Daniel Vetter, Cihangir Akturk,
Dave Airlie, dri-devel, linux-kernel
Hi Arnd,
On Thu, 2 Nov 2017 12:20:43 +0100
Arnd Bergmann <arnd@arndb.de> wrote:
> Printing a size_t variable needs to use the %z format string modifier
> rather than %l, otherwise we get this warning on 64-bit architectures:
>
> drivers/gpu/drm/vc4/vc4_bo.c: In function 'vc4_bo_stats_debugfs':
> drivers/gpu/drm/vc4/vc4_bo.c:91:26: error: format '%d' expects argument of type 'int', but argument 4 has type 'size_t {aka long unsigned int}' [-Werror=format=]
>
I already sent (and applied) a fix for this bug [1].
Regards,
Boris
[1]https://patchwork.kernel.org/patch/10036075/
> Fixes: b9f19259b84d ("drm/vc4: Add the DRM_IOCTL_VC4_GEM_MADVISE ioctl")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/gpu/drm/vc4/vc4_bo.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
> index 3c3d11236910..4ae45d7dac42 100644
> --- a/drivers/gpu/drm/vc4/vc4_bo.c
> +++ b/drivers/gpu/drm/vc4/vc4_bo.c
> @@ -88,11 +88,11 @@ int vc4_bo_stats_debugfs(struct seq_file *m, void *unused)
>
> mutex_lock(&vc4->purgeable.lock);
> if (vc4->purgeable.num)
> - seq_printf(m, "%30s: %6dkb BOs (%d)\n", "userspace BO cache",
> + seq_printf(m, "%30s: %6zdkb BOs (%d)\n", "userspace BO cache",
> vc4->purgeable.size / 1024, vc4->purgeable.num);
>
> if (vc4->purgeable.purged_num)
> - seq_printf(m, "%30s: %6dkb BOs (%d)\n", "total purged BO",
> + seq_printf(m, "%30s: %6zdkb BOs (%d)\n", "total purged BO",
> vc4->purgeable.purged_size / 1024,
> vc4->purgeable.purged_num);
> mutex_unlock(&vc4->purgeable.lock);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-02 11:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-02 11:20 [PATCH] drm/vc4: use %z format string for size_t Arnd Bergmann
2017-11-02 11:56 ` Boris Brezillon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).