video: fbdev: atmel: fix warning for const return value

Started by Rob Herring on Jul 27, 2015 · 4 messages from 4 authors · Last reply Aug 20, 2015

Subsystems (3)

Maintainers (3)

STALE4099d

open the first message on its own page

Message details and related content
A const on a return value is meaningless and generates a warning on some
versions of gcc:

drivers/video/fbdev/atmel_lcdfb.c:1003: warning: type qualifiers ignored on function return type

This was found on 0-day with avr32 builds with CONFIG_OF enabled, but
it doesn't seem to generate warnings for other arches.

Reported-by: Fengguang Wu <redacted>
Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Nicolas Ferre <redacted>
Cc: Jean-Christophe Plagniol-Villard <redacted>
Cc: Tomi Valkeinen <redacted>
---
 drivers/video/fbdev/atmel_lcdfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index abadc49..66f4b70 100644
--- a/drivers/video/fbdev/atmel_lcdfb.c
+++ b/drivers/video/fbdev/atmel_lcdfb.c
@@ -999,7 +999,7 @@ static const char *atmel_lcdfb_wiring_modes[] = {
 	[ATMEL_LCDC_WIRING_RGB]	= "RGB",
 };
 
-const int atmel_lcdfb_get_of_wiring_modes(struct device_node *np)
+int atmel_lcdfb_get_of_wiring_modes(struct device_node *np)
 {
 	const char *mode;
 	int err, i;
-- 
2.1.0
Message details and related content
Le 27/07/2015 17:41, Rob Herring a écrit :
A const on a return value is meaningless and generates a warning on some
versions of gcc:

drivers/video/fbdev/atmel_lcdfb.c:1003: warning: type qualifiers ignored on function return type

This was found on 0-day with avr32 builds with CONFIG_OF enabled, but
it doesn't seem to generate warnings for other arches.

Reported-by: Fengguang Wu <redacted>
Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Nicolas Ferre <redacted>
Sure:
Acked-by: Nicolas Ferre <redacted>

Thanks Rob!
quoted hunk
Cc: Jean-Christophe Plagniol-Villard <redacted>
Cc: Tomi Valkeinen <redacted>
---
 drivers/video/fbdev/atmel_lcdfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index abadc49..66f4b70 100644
--- a/drivers/video/fbdev/atmel_lcdfb.c
+++ b/drivers/video/fbdev/atmel_lcdfb.c
@@ -999,7 +999,7 @@ static const char *atmel_lcdfb_wiring_modes[] = {
 	[ATMEL_LCDC_WIRING_RGB]	= "RGB",
 };
 
-const int atmel_lcdfb_get_of_wiring_modes(struct device_node *np)
+int atmel_lcdfb_get_of_wiring_modes(struct device_node *np)
 {
 	const char *mode;
 	int err, i;

-- 
Nicolas Ferre
Message details and related content
On Mon, Jul 27, 2015 at 10:41:41AM -0500, Rob Herring wrote:
A const on a return value is meaningless and generates a warning on some
versions of gcc:

drivers/video/fbdev/atmel_lcdfb.c:1003: warning: type qualifiers ignored on function return type
maybe this one should have been static instead of const.

regards
sudip
Message details and related content
On 07/08/15 08:22, Sudip Mukherjee wrote:
On Mon, Jul 27, 2015 at 10:41:41AM -0500, Rob Herring wrote:
quoted
A const on a return value is meaningless and generates a warning on some
versions of gcc:

drivers/video/fbdev/atmel_lcdfb.c:1003: warning: type qualifiers ignored on function return type
maybe this one should have been static instead of const.
I think that makes sense. I will apply the following patch instead of Rob's,
if no one complains.

Author: Tomi Valkeinen [off-list ref]
Date:   Thu Aug 20 13:46:10 2015 +0300

    video: fbdev: atmel: fix warning for const return value
    
    A const on a return value is meaningless and generates a warning on some
    versions of gcc:
    
    drivers/video/fbdev/atmel_lcdfb.c:1003: warning: type qualifiers ignored on function return type
    
    The function in question is only used inside the .c file, so the author
    of the code most likely means "static" instead of "const".
    
    Change the const to static.
    
    Reported-by: Fengguang Wu [off-list ref]
    Cc: Nicolas Ferre [off-list ref]
    Signed-off-by: Tomi Valkeinen [off-list ref]
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c
index abadc490fa1f..016cae1425a4 100644
--- a/drivers/video/fbdev/atmel_lcdfb.c
+++ b/drivers/video/fbdev/atmel_lcdfb.c
@@ -999,7 +999,7 @@ static const char *atmel_lcdfb_wiring_modes[] = {
 	[ATMEL_LCDC_WIRING_RGB]	= "RGB",
 };
 
-const int atmel_lcdfb_get_of_wiring_modes(struct device_node *np)
+static int atmel_lcdfb_get_of_wiring_modes(struct device_node *np)
 {
 	const char *mode;
 	int err, i;
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help