Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1702988

[PATCH 3/3] drm/msm: use %z format modifier for printing size_t

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH 3/3] drm/msm: use %z format modifier for printing size_t
Date 2017-08-03 14:00 +0200
Message-ID <uamXg-7T1-13@gated-at.bofh.it> (permalink)
References <uamXg-7T1-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The return type of ARRAY_SIZE() is size_t, so we have to use
%zu instead of %lu to avoid this warning:

drivers/gpu/drm/msm/msm_gpu.c: In function 'msm_gpu_init':
drivers/gpu/drm/msm/msm_gpu.c:742:31: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'unsigned int' [-Werror=format=]

The warning it otherwise harmless as size_t is always the
same size as unsigned long in all supported architectures,
but gcc doesn't know that.

Fixes: c2fceabca6d5 ("drm/msm: Support multiple ringbuffers")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/msm/msm_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 1e44f8893490..66af5ac334ba 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -739,7 +739,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
 	}
 
 	if (nr_rings > ARRAY_SIZE(gpu->rb)) {
-		DRM_DEV_INFO_ONCE(drm->dev, "Only creating %lu ringbuffers\n",
+		DRM_DEV_INFO_ONCE(drm->dev, "Only creating %zu ringbuffers\n",
 			ARRAY_SIZE(gpu->rb));
 		nr_rings = ARRAY_SIZE(gpu->rb);
 	}
-- 
2.9.0

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] drm/msm: remove unused variable Arnd Bergmann <arnd@arndb.de> - 2017-08-03 14:00 +0200
  [PATCH 3/3] drm/msm: use %z format modifier for printing size_t Arnd Bergmann <arnd@arndb.de> - 2017-08-03 14:00 +0200
  [PATCH 2/3] drm/msm/mdp5: mark runtime_pm functions as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2017-08-03 14:00 +0200
    Re: [PATCH 2/3] drm/msm/mdp5: mark runtime_pm functions as  __maybe_unused Archit Taneja <architt@codeaurora.org> - 2017-08-04 12:40 +0200

csiph-web