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: 5145531be5 ("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>
This commit is contained in:
Artur Weber 2023-08-09 13:42:16 +02:00 committed by Lee Jones
parent fe1328b5b2
commit dfd122fe85
1 changed files with 3 additions and 5 deletions

View File

@ -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 = {