Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 5145531be5fb ("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>

authored by

Artur Weber and committed by
Lee Jones
dfd122fe fe1328b5

+3 -5
+3 -5
drivers/video/backlight/lp855x_bl.c
··· 241 241 { 242 242 struct lp855x *lp = bl_get_data(bl); 243 243 int brightness = bl->props.brightness; 244 - int ret; 245 244 246 245 if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) 247 246 brightness = 0; 248 247 249 248 if (lp->mode == PWM_BASED) 250 - ret = lp855x_pwm_ctrl(lp, brightness, 249 + return lp855x_pwm_ctrl(lp, brightness, 251 250 bl->props.max_brightness); 252 251 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, 254 253 (u8)brightness); 255 - 256 - return ret; 254 + return -EINVAL; 257 255 } 258 256 259 257 static const struct backlight_ops lp855x_bl_ops = {