Skip to contentSkip to conversation

mfd: max8925: max8925_backlight_probe: Silence 'statement with no effect' warning

PATCH In review Tim Gardner 2 participants 2 messages Mar 10, 2013 – Mar 11, 2013

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

PATCH 1/1 mfd: max8925: max8925_backlight_probe: Silence 'statement with no effect' warning

Commit 47ec340cb8e232671e7c4a4689ff32c3bdf329da 'mfd: max8925: Support dt for backlight' caused a gcc warning if CONFIG_OF is not defined:

drivers/video/backlight/max8925_bl.c: In function 'max8925_backlight_probe':
drivers/video/backlight/max8925_bl.c:177:3: warning: statement with no effect [-Wunused-value]

gcc version 4.6.3

Convert max8925_backlight_dt_init() to an 'inline void' since it is only called from one place where the return code is ignored. Protect the guts of the function with '#ifdef CONFIG_OF'.

Cc Richard Purdie <[email protected]>
Cc Florian Tobias Schandinat <[email protected]>
---
 drivers/video/backlight/max8925_bl.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/video/backlight/max8925_bl.c +3 -6
index 5ca11b0..199f887 100644
@@ -101,10 +101,10 @@ static const struct backlight_ops max8925_backlight_ops = {
 	.get_brightness	= max8925_backlight_get_brightness,
 };
 
-#ifdef CONFIG_OF
-static int max8925_backlight_dt_init(struct platform_device *pdev,
+static inline void max8925_backlight_dt_init(struct platform_device *pdev,
 			      struct max8925_backlight_pdata *pdata)
 {
+#ifdef CONFIG_OF
 	struct device_node *nproot = pdev->dev.parent->of_node, *np;
 	int dual_string;
 
@@ -118,11 +118,8 @@ static int max8925_backlight_dt_init(struct platform_device *pdev,
 
 	of_property_read_u32(np, "maxim,max8925-dual-string", &dual_string);
 	pdata->dual_string = dual_string;
-	return 0;
-}
-#else
-#define max8925_backlight_dt_init(x, y)	(-1)
 #endif
+}
 
 static int max8925_backlight_probe(struct platform_device *pdev)
 {
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 9 lines · Tim Gardner

drivers/video/backlight/max8925_bl.c: In function 'max8925_backlight_probe':
drivers/video/backlight/max8925_bl.c:177:3: warning: statement with no effect [-Wunused-value]

gcc version 4.6.3

Convert max8925_backlight_dt_init() to an 'inline void' since it is only called from one place where the return code is ignored. Protect the guts of the function with '#ifdef CONFIG_OF'.

Quoted 7 lines
Cc Richard Purdie <[email protected]>
Cc Florian Tobias Schandinat <[email protected]>
---
 drivers/video/backlight/max8925_bl.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

I had already sent a better patch for this earlier, see "mfd: max8925:
fix trivial build warning for non-dt". Unfortunately when I looked into the problem again, I found more problems with the original patches, apparently the DT bindings were never properly reviewed. It may be better to revert the original patch for 3.9 and do it better for 3.10.

Arnd