Skip to contentSkip to conversation

backlight: lp855x: Drop ret variable in brightness change function

PATCH Applied Artur Weber 4 participants 4 messages Aug 9, 2023 – Aug 18, 2023

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

PATCH 1/1 backlight: lp855x: Drop ret variable in brightness change function

Fixes the following warning:

drivers/video/backlight/lp855x_bl.c:252:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

Fixes 5145531be5fb ("backlight: lp855x: Catch errors when changing brightness")
---
 drivers/video/backlight/lp855x_bl.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/video/backlight/lp855x_bl.c +3 -5
index 61a7f45bfad8..da1f124db69c 100644
@@ -241,19 +241,17 @@ static int lp855x_bl_update_status(struct backlight_device *bl)
 {
 	struct lp855x *lp = bl_get_data(bl);
 	int brightness = bl->props.brightness;
-	int ret;
 
 	if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
 		brightness = 0;
 
 	if (lp->mode == PWM_BASED)
-		ret = lp855x_pwm_ctrl(lp, brightness,
+		return lp855x_pwm_ctrl(lp, brightness,
 				      bl->props.max_brightness);
 	else if (lp->mode == REGISTER_BASED)
-		ret = lp855x_write_byte(lp, lp->cfg->reg_brightness,
+		return lp855x_write_byte(lp, lp->cfg->reg_brightness,
 					(u8)brightness);
-
-	return ret;
+	return -EINVAL;
 }
 
 static const struct backlight_ops lp855x_bl_ops = {

base-commit: 21ef7b1e17d039053edaeaf41142423810572741

Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Artur Weber

Fixes the following warning:

drivers/video/backlight/lp855x_bl.c:252:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

Fixes 5145531be5fb ("backlight: lp855x: Catch errors when changing brightness")
Reviewed-by on v1 1/1
#2 lore raw
In reply to Artur Weber
Quoted 9 lines · Artur Weber

Fixes the following warning:

drivers/video/backlight/lp855x_bl.c:252:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

Fixes 5145531be5fb ("backlight: lp855x: Catch errors when changing brightness")
Quoted 36 lines
---
 drivers/video/backlight/lp855x_bl.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/video/backlight/lp855x_bl.c +3 -5
index 61a7f45bfad8..da1f124db69c 100644
@@ -241,19 +241,17 @@ static int lp855x_bl_update_status(struct backlight_device *bl)
 {
 	struct lp855x *lp = bl_get_data(bl);
 	int brightness = bl->props.brightness;
-	int ret;
 
 	if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
 		brightness = 0;
 
 	if (lp->mode == PWM_BASED)
-		ret = lp855x_pwm_ctrl(lp, brightness,
+		return lp855x_pwm_ctrl(lp, brightness,
 				      bl->props.max_brightness);
 	else if (lp->mode == REGISTER_BASED)
-		ret = lp855x_write_byte(lp, lp->cfg->reg_brightness,
+		return lp855x_write_byte(lp, lp->cfg->reg_brightness,
 					(u8)brightness);
-
-	return ret;
+	return -EINVAL;
 }
 
 static const struct backlight_ops lp855x_bl_ops = {

base-commit: 21ef7b1e17d039053edaeaf41142423810572741

Signature · 1 line
2.41.0
maintainer Applied
#3 lore raw

Re: (subset) [PATCH] backlight: lp855x: Drop ret variable in brightness change function

In reply to Artur Weber
Quoted 6 lines · Artur Weber

Fixes the following warning:

drivers/video/backlight/lp855x_bl.c:252:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

Applied, thanks!

[1/1] backlight: lp855x: Drop ret variable in brightness change function

      commit: dfd122fe8591d513b5e51313601217b67ae98d13

--
Lee Jones [李琼斯]