drm/tinydrm: Fix compiler warnings
Subsystems (2)
cover drm/tinydrm: Fix compiler warnings
Dave pulled tinydrm yesterday which triggered some compiler warnings:
Dave Airlie:drivers/gpu/drm/tinydrm/mipi-dbi.c: In function ‘mipi_dbi_debugfs_command_write’:drivers/gpu/drm/tinydrm/mipi-dbi.c:905:8: warning: ‘cmd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ret = mipi_dbi_command_buf(mipi, cmd, parameters, i);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~I didn't see this on gcc 4.8, but it showed up when I used gcc 6.2.
kbuild test robot:
[drm:drm-next 1199/1208] drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c:198:26: error: redefinition of 'tinydrm_of_find_backlight'
kbuild test robot:
drivers/gpu/drm/tinydrm/mipi-dbi.c: In function 'mipi_dbi_typec1_command':
Quoted 1 line
Quoted 1 line
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__)
^~~Quoted 1 line
Quoted 1 line
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);
^~~~~~~~~~~~~~~~~~~~~~Noralf.
Noralf Trønnes (3):
drm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized drm/tinydrm: mipi-dbi: Fix field width specifier warning drm/tinydrm: helpers: Properly fix backlight dependency
drivers/gpu/drm/tinydrm/mipi-dbi.c | 6 +++--- include/drm/tinydrm/tinydrm-helpers.h | 19 ------------------- 2 files changed, 3 insertions(+), 22 deletions(-)
--
2.10.2
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/3 drm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized
Fix this warning:drivers/gpu/drm/tinydrm/mipi-dbi.c: In function ‘mipi_dbi_debugfs_command_write’:drivers/gpu/drm/tinydrm/mipi-dbi.c:905:8: warning: ‘cmd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ret = mipi_dbi_command_buf(mipi, cmd, parameters, i);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cmd can't be used uninitialized, but to satisfy the compiler, initialize it to zero.
--- drivers/gpu/drm/tinydrm/mipi-dbi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tinydrm/mipi-dbi.c +1 -1
@@ -863,7 +863,7 @@ static ssize_t mipi_dbi_debugfs_command_write(struct file *file, {struct seq_file *m = file->private_data;struct mipi_dbi *mipi = m->private; -u8 val, cmd, parameters[64 ]; +u8 val, cmd =0 , parameters[64 ];char *buf, *pos, *token;unsigned int i;int ret;
Signature · 6 lines
2.10.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/3 drm/tinydrm: mipi-dbi: Fix field width specifier warning
In reply to Noralf TrønnesThis warning is seen on 64-bit builds in functions:
'mipi_dbi_typec1_command':
'mipi_dbi_typec3_command_read':
'mipi_dbi_typec3_command':
Quoted 1 line
Quoted 1 line
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__)
^~~Quoted 1 line
Quoted 1 line
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.
--- drivers/gpu/drm/tinydrm/mipi-dbi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tinydrm/mipi-dbi.c +2 -2
@@ -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[] = {
Signature · 6 lines
2.10.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 drm/tinydrm: helpers: Properly fix backlight dependency
In reply to Noralf TrønnesBACKLIGHT_CLASS_DEVICE was selected in the last version of the tinydrm patchset to fix the backlight dependency, but the ifdef CONFIG_BACKLIGHT_CLASS_DEVICE was forgotten. Fix that.
--- include/drm/tinydrm/tinydrm-helpers.h | 19 ------------------- 1 file changed, 19 deletions(-)
include/drm/tinydrm/tinydrm-helpers.h +0 -19
@@ -44,28 +44,9 @@ void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,struct drm_framebuffer *fb, struct drm_clip_rect *clip, bool swap); -#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE struct backlight_device *tinydrm_of_find_backlight (struct device *dev);int tinydrm_enable_backlight (struct backlight_device *backlight);int tinydrm_disable_backlight (struct backlight_device *backlight); -#else -static inline struct backlight_device * -tinydrm_of_find_backlight (struct device *dev) -{ -return NULL ; -} - -static inline int tinydrm_enable_backlight (struct backlight_device *backlight) -{ -return 0 ; -} - -static inline int -tinydrm_disable_backlight (struct backlight_device *backlight) -{ -return 0 ; -} -#endif size_t tinydrm_spi_max_transfer_size (struct spi_device *spi,size_t max_len);bool tinydrm_spi_bpw_supported (struct spi_device *spi,u8 bpw);
Signature · 6 lines
2.10.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/tinydrm: helpers: Properly fix backlight dependency
Den 23.02.2017 14.29, skrev Noralf Trønnes:
Quoted 6 lines
BACKLIGHT_CLASS_DEVICEwas selected in the last version of the tinydrm patchset to fix the backlight dependency, but the ifdefCONFIG_BACKLIGHT_CLASS_DEVICEwas forgotten. Fix that.Signed-off-by Noralf Trønnes <[email protected]>---
Please apply this, it causes a build error if backlight is built as a module. In my haste to fix the problems reported after tinydrm was pulled, I mistook it for a warning so it was mislabeled. Sorry about the noise caused by tinydrm.
Noralf.
Quoted 36 lines
include/drm/tinydrm/tinydrm-helpers.h | 19 ------------------- 1 file changed, 19 deletions(-)include/drm/tinydrm/tinydrm-helpers.h +0
-19@@ -44,28 +44,9 @@ void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,struct drm_framebuffer *fb, struct drm_clip_rect *clip, bool swap); -#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE struct backlight_device *tinydrm_of_find_backlight (struct device *dev);int tinydrm_enable_backlight (struct backlight_device *backlight);int tinydrm_disable_backlight (struct backlight_device *backlight); -#else -static inline struct backlight_device * -tinydrm_of_find_backlight (struct device *dev) -{ -return NULL ; -} - -static inline int tinydrm_enable_backlight (struct backlight_device *backlight) -{ -return 0 ; -} - -static inline int -tinydrm_disable_backlight (struct backlight_device *backlight) -{ -return 0 ; -} -#endif size_t tinydrm_spi_max_transfer_size (struct spi_device *spi,size_t max_len);bool tinydrm_spi_bpw_supported (struct spi_device *spi,u8 bpw);
Re: [PATCH 3/3] drm/tinydrm: helpers: Properly fix backlight dependency
Quoted 6 lines · Noralf Trønnes
Den 23.02.2017 14.29, skrev Noralf Trønnes:
Quoted 4 lines
BACKLIGHT_CLASS_DEVICEwas selected in the last version of the tinydrm patchset to fix the backlight dependency, but the ifdefCONFIG_BACKLIGHT_CLASS_DEVICEwas forgotten. Fix that.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Noralf Trønnes <[email protected]>---
Please apply this, it causes a build error if backlight is built as a module. In my haste to fix the problems reported after tinydrm was pulled, I mistook it for a warning so it was mislabeled. Sorry about the noise caused by tinydrm.
They are all already applied and in Linus' tree. Dave Airlie generally doesn't send out a mail when he merges stuff.
-Daniel
Quoted 39 lines
Noralf.
Quoted 34 lines
include/drm/tinydrm/tinydrm-helpers.h | 19 ------------------- 1 file changed, 19 deletions(-)include/drm/tinydrm/tinydrm-helpers.h +0
-19@@ -44,28 +44,9 @@ void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,struct drm_framebuffer *fb, struct drm_clip_rect *clip, bool swap); -#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE struct backlight_device *tinydrm_of_find_backlight (struct device *dev);int tinydrm_enable_backlight (struct backlight_device *backlight);int tinydrm_disable_backlight (struct backlight_device *backlight); -#else -static inline struct backlight_device * -tinydrm_of_find_backlight (struct device *dev) -{ -return NULL ; -} - -static inline int tinydrm_enable_backlight (struct backlight_device *backlight) -{ -return 0 ; -} - -static inline int -tinydrm_disable_backlight (struct backlight_device *backlight) -{ -return 0 ; -} -#endif size_t tinydrm_spi_max_transfer_size (struct spi_device *spi,size_t max_len);bool tinydrm_spi_bpw_supported (struct spi_device *spi,u8 bpw);
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
I see that I forgot cc'ing Dave Airlie on this, and I just realised that the backlight problem isn't just a warning, but it actually causes a build failure if backlight is built as a module.
I missed this in my hurry to get this out the door, sorry.
Den 23.02.2017 14.29, skrev Noralf Trønnes:
Quoted 32 lines
Dave pulled tinydrm yesterday which triggered some compiler warnings:
Dave Airlie:
drivers/gpu/drm/tinydrm/mipi-dbi.c: In function ‘mipi_dbi_debugfs_command_write’:drivers/gpu/drm/tinydrm/mipi-dbi.c:905:8: warning: ‘cmd’ may be used uninitialized in this function [-Wmaybe-uninitialized]ret = mipi_dbi_command_buf(mipi, cmd, parameters, i); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~I didn't see this on gcc 4.8, but it showed up when I used gcc 6.2.
kbuild test robot:
[drm:drm-next 1199/1208]drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c:198:26: error: redefinition of 'tinydrm_of_find_backlight'kbuild test robot:
drivers/gpu/drm/tinydrm/mipi-dbi.c: In function 'mipi_dbi_typec1_command':Quoted 1 line
Quoted 1 line
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__) ^~~Quoted 1 line
Quoted 1 line
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); ^~~~~~~~~~~~~~~~~~~~~~Noralf.
Noralf Trønnes (3):
drm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized drm/tinydrm: mipi-dbi: Fix field width specifier warning drm/tinydrm: helpers: Properly fix backlight dependency
Quoted 7 lines
drivers/gpu/drm/tinydrm/mipi-dbi.c | 6 +++--- include/drm/tinydrm/tinydrm-helpers.h | 19 ------------------- 2 files changed, 3 insertions(+), 22 deletions(-)--
2.10.2
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel