Skip to content

Commit dfd122f

Browse files
refractionwarelag-linaro
authored andcommitted
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] Signed-off-by: Artur Weber <aweber.kernel@gmail.com> Fixes: 5145531 ("backlight: lp855x: Catch errors when changing brightness") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202308091728.NEJhgUPP-lkp@intel.com/ Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20230809114216.4078-1-aweber.kernel@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
1 parent fe1328b commit dfd122f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/video/backlight/lp855x_bl.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,19 +241,17 @@ static int lp855x_bl_update_status(struct backlight_device *bl)
241241
{
242242
struct lp855x *lp = bl_get_data(bl);
243243
int brightness = bl->props.brightness;
244-
int ret;
245244

246245
if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
247246
brightness = 0;
248247

249248
if (lp->mode == PWM_BASED)
250-
ret = lp855x_pwm_ctrl(lp, brightness,
249+
return lp855x_pwm_ctrl(lp, brightness,
251250
bl->props.max_brightness);
252251
else if (lp->mode == REGISTER_BASED)
253-
ret = lp855x_write_byte(lp, lp->cfg->reg_brightness,
252+
return lp855x_write_byte(lp, lp->cfg->reg_brightness,
254253
(u8)brightness);
255-
256-
return ret;
254+
return -EINVAL;
257255
}
258256

259257
static const struct backlight_ops lp855x_bl_ops = {

0 commit comments

Comments
 (0)