Skip to contentSkip to conversation

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

PATCH In review Rob Herring 4 participants 4 messages Jul 27, 2015 – Aug 20, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

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

Cc Nicolas Ferre <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
---
 drivers/video/fbdev/atmel_lcdfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/atmel_lcdfb.c +1 -1
index abadc49..66f4b70 100644
@@ -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;
Signature · 1 line
2.1.0
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Rob Herring

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.

Sure:

Thanks Rob!

Quoted 20 lines
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
---
 drivers/video/fbdev/atmel_lcdfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/atmel_lcdfb.c +1 -1
index abadc49..66f4b70 100644
@@ -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;
Signature · 1 line
Nicolas Ferre
#2 lore raw
In reply to Rob Herring
Quoted 4 lines · Rob Herring

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

#3 lore raw
Quoted 6 lines · Sudip Mukherjee
Quoted 4 lines · Rob Herring

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 <[email protected]>
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.

drivers/video/fbdev/atmel_lcdfb.c +1 -1
index abadc490fa1f..016cae1425a4 100644
@@ -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;