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


Groups > linux.kernel > #1586891

[PATCH 2/3] drm/tinydrm: mipi-dbi: Fix field width specifier warning

From Noralf Trønnes <noralf@tronnes.org>
Newsgroups linux.kernel
Subject [PATCH 2/3] drm/tinydrm: mipi-dbi: Fix field width specifier warning
Date 2017-02-23 14:40 +0100
Message-ID <te1ML-1Qh-39@gated-at.bofh.it> (permalink)
References <te1MK-1Qh-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This warning is seen on 64-bit builds in functions:
   'mipi_dbi_typec1_command':
   'mipi_dbi_typec3_command_read':
   'mipi_dbi_typec3_command':

>> drivers/gpu/drm/tinydrm/mipi-dbi.c:65:20: warning: field width specifier '*' expects argument of type 'int', but argument 5 has type 'size_t {aka long unsigned int}' [-Wformat=]
      DRM_DEBUG_DRIVER("cmd=%02x, par=%*ph\n", cmd, len, data); \
                       ^
   include/drm/drmP.h:228:40: note: in definition of macro 'DRM_DEBUG_DRIVER'
     drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
                                           ^~~
>> drivers/gpu/drm/tinydrm/mipi-dbi.c:671:2: note: in expansion of macro 'MIPI_DBI_DEBUG_COMMAND'
     MIPI_DBI_DEBUG_COMMAND(cmd, parameters, num);
     ^~~~~~~~~~~~~~~~~~~~~~

Fix by casting 'len' to int in the macro MIPI_DBI_DEBUG_COMMAND().
There is no chance of overflow.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/tinydrm/mipi-dbi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c
index 2caecde..2d21b49 100644
--- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
+++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
@@ -62,9 +62,9 @@
 	if (!len) \
 		DRM_DEBUG_DRIVER("cmd=%02x\n", cmd); \
 	else if (len <= 32) \
-		DRM_DEBUG_DRIVER("cmd=%02x, par=%*ph\n", cmd, len, data); \
+		DRM_DEBUG_DRIVER("cmd=%02x, par=%*ph\n", cmd, (int)len, data);\
 	else \
-		DRM_DEBUG_DRIVER("cmd=%02x, len=%zu\n", cmd, len); \
+		DRM_DEBUG_DRIVER("cmd=%02x, len=%zu\n", cmd, (int)len); \
 })
 
 static const u8 mipi_dbi_dcs_read_commands[] = {
-- 
2.10.2

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


Thread

[PATCH 0/3] drm/tinydrm: Fix compiler warnings Noralf Trønnes <noralf@tronnes.org> - 2017-02-23 14:40 +0100
  [PATCH 1/3] drm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized Noralf Trønnes <noralf@tronnes.org> - 2017-02-23 14:40 +0100
  [PATCH 2/3] drm/tinydrm: mipi-dbi: Fix field width specifier warning Noralf Trønnes <noralf@tronnes.org> - 2017-02-23 14:40 +0100
  [PATCH 3/3] drm/tinydrm: helpers: Properly fix backlight dependency Noralf Trønnes <noralf@tronnes.org> - 2017-02-23 14:40 +0100
    Re: [PATCH 3/3] drm/tinydrm: helpers: Properly fix backlight  dependency Noralf Trønnes <noralf@tronnes.org> - 2017-02-26 23:50 +0100
      Re: [PATCH 3/3] drm/tinydrm: helpers: Properly fix backlight  dependency Daniel Vetter <daniel@ffwll.ch> - 2017-02-27 01:10 +0100
  Re: [PATCH 0/3] drm/tinydrm: Fix compiler warnings Noralf Trønnes <noralf@tronnes.org> - 2017-02-24 02:40 +0100

csiph-web