* [PATCH 0/3] drm/tinydrm: Fix compiler warnings
@ 2017-02-23 13:29 Noralf Trønnes
2017-02-23 13:29 ` [PATCH 1/3] drm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized Noralf Trønnes
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Noralf Trønnes @ 2017-02-23 13:29 UTC (permalink / raw)
To: dri-devel; +Cc: linux-kernel, Noralf Trønnes
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':
>> 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);
^~~~~~~~~~~~~~~~~~~~~~
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] drm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized
2017-02-23 13:29 [PATCH 0/3] drm/tinydrm: Fix compiler warnings Noralf Trønnes
@ 2017-02-23 13:29 ` Noralf Trønnes
2017-02-23 13:29 ` [PATCH 2/3] drm/tinydrm: mipi-dbi: Fix field width specifier warning Noralf Trønnes
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Noralf Trønnes @ 2017-02-23 13:29 UTC (permalink / raw)
To: dri-devel; +Cc: linux-kernel, Noralf Trønnes
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.
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
drivers/gpu/drm/tinydrm/mipi-dbi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c
index 07d49ba..2caecde 100644
--- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
+++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
@@ -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;
--
2.10.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] drm/tinydrm: mipi-dbi: Fix field width specifier warning
2017-02-23 13:29 [PATCH 0/3] drm/tinydrm: Fix compiler warnings Noralf Trønnes
2017-02-23 13:29 ` [PATCH 1/3] drm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized Noralf Trønnes
@ 2017-02-23 13:29 ` Noralf Trønnes
2017-02-23 13:29 ` [PATCH 3/3] drm/tinydrm: helpers: Properly fix backlight dependency Noralf Trønnes
2017-02-24 1:36 ` [PATCH 0/3] drm/tinydrm: Fix compiler warnings Noralf Trønnes
3 siblings, 0 replies; 7+ messages in thread
From: Noralf Trønnes @ 2017-02-23 13:29 UTC (permalink / raw)
To: dri-devel; +Cc: linux-kernel, Noralf Trønnes
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] drm/tinydrm: helpers: Properly fix backlight dependency
2017-02-23 13:29 [PATCH 0/3] drm/tinydrm: Fix compiler warnings Noralf Trønnes
2017-02-23 13:29 ` [PATCH 1/3] drm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized Noralf Trønnes
2017-02-23 13:29 ` [PATCH 2/3] drm/tinydrm: mipi-dbi: Fix field width specifier warning Noralf Trønnes
@ 2017-02-23 13:29 ` Noralf Trønnes
2017-02-26 22:44 ` Noralf Trønnes
2017-02-24 1:36 ` [PATCH 0/3] drm/tinydrm: Fix compiler warnings Noralf Trønnes
3 siblings, 1 reply; 7+ messages in thread
From: Noralf Trønnes @ 2017-02-23 13:29 UTC (permalink / raw)
To: dri-devel; +Cc: linux-kernel, Noralf Trønnes
BACKLIGHT_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.
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
include/drm/tinydrm/tinydrm-helpers.h | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/include/drm/tinydrm/tinydrm-helpers.h b/include/drm/tinydrm/tinydrm-helpers.h
index 78175fe..9b9b6cf 100644
--- a/include/drm/tinydrm/tinydrm-helpers.h
+++ b/include/drm/tinydrm/tinydrm-helpers.h
@@ -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);
--
2.10.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] drm/tinydrm: Fix compiler warnings
2017-02-23 13:29 [PATCH 0/3] drm/tinydrm: Fix compiler warnings Noralf Trønnes
` (2 preceding siblings ...)
2017-02-23 13:29 ` [PATCH 3/3] drm/tinydrm: helpers: Properly fix backlight dependency Noralf Trønnes
@ 2017-02-24 1:36 ` Noralf Trønnes
3 siblings, 0 replies; 7+ messages in thread
From: Noralf Trønnes @ 2017-02-24 1:36 UTC (permalink / raw)
To: dri-devel; +Cc: linux-kernel, Dave Airlie
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:
> 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':
>>> 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);
> ^~~~~~~~~~~~~~~~~~~~~~
>
> 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
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] drm/tinydrm: helpers: Properly fix backlight dependency
2017-02-23 13:29 ` [PATCH 3/3] drm/tinydrm: helpers: Properly fix backlight dependency Noralf Trønnes
@ 2017-02-26 22:44 ` Noralf Trønnes
2017-02-27 0:00 ` Daniel Vetter
0 siblings, 1 reply; 7+ messages in thread
From: Noralf Trønnes @ 2017-02-26 22:44 UTC (permalink / raw)
To: dri-devel, Daniel Vetter; +Cc: linux-kernel
Den 23.02.2017 14.29, skrev Noralf Trønnes:
> BACKLIGHT_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.
>
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> ---
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.
> include/drm/tinydrm/tinydrm-helpers.h | 19 -------------------
> 1 file changed, 19 deletions(-)
>
> diff --git a/include/drm/tinydrm/tinydrm-helpers.h b/include/drm/tinydrm/tinydrm-helpers.h
> index 78175fe..9b9b6cf 100644
> --- a/include/drm/tinydrm/tinydrm-helpers.h
> +++ b/include/drm/tinydrm/tinydrm-helpers.h
> @@ -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);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] drm/tinydrm: helpers: Properly fix backlight dependency
2017-02-26 22:44 ` Noralf Trønnes
@ 2017-02-27 0:00 ` Daniel Vetter
0 siblings, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2017-02-27 0:00 UTC (permalink / raw)
To: Noralf Trønnes; +Cc: dri-devel, Daniel Vetter, linux-kernel
On Sun, Feb 26, 2017 at 11:44:40PM +0100, Noralf Trønnes wrote:
>
> Den 23.02.2017 14.29, skrev Noralf Trønnes:
> > BACKLIGHT_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.
> >
> > Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
> > ---
>
> 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
>
> Noralf.
>
>
> > include/drm/tinydrm/tinydrm-helpers.h | 19 -------------------
> > 1 file changed, 19 deletions(-)
> >
> > diff --git a/include/drm/tinydrm/tinydrm-helpers.h b/include/drm/tinydrm/tinydrm-helpers.h
> > index 78175fe..9b9b6cf 100644
> > --- a/include/drm/tinydrm/tinydrm-helpers.h
> > +++ b/include/drm/tinydrm/tinydrm-helpers.h
> > @@ -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);
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-02-27 0:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-23 13:29 [PATCH 0/3] drm/tinydrm: Fix compiler warnings Noralf Trønnes
2017-02-23 13:29 ` [PATCH 1/3] drm/tinydrm: mipi-dbi: Silence: ‘cmd’ may be used uninitialized Noralf Trønnes
2017-02-23 13:29 ` [PATCH 2/3] drm/tinydrm: mipi-dbi: Fix field width specifier warning Noralf Trønnes
2017-02-23 13:29 ` [PATCH 3/3] drm/tinydrm: helpers: Properly fix backlight dependency Noralf Trønnes
2017-02-26 22:44 ` Noralf Trønnes
2017-02-27 0:00 ` Daniel Vetter
2017-02-24 1:36 ` [PATCH 0/3] drm/tinydrm: Fix compiler warnings Noralf Trønnes
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).