linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] backlight: lp855x: Drop ret variable in brightness change function
@ 2023-08-09 11:42 Artur Weber
  2023-08-09 16:38 ` Daniel Thompson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Artur Weber @ 2023-08-09 11:42 UTC (permalink / raw)
  To: Lee Jones
  Cc: Daniel Thompson, Jingoo Han, Helge Deller, Artur Weber, dri-devel,
	linux-fbdev, linux-kernel, kernel test robot

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/
---
 drivers/video/backlight/lp855x_bl.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index 61a7f45bfad8..da1f124db69c 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -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
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] backlight: lp855x: Drop ret variable in brightness change function
  2023-08-09 11:42 [PATCH] backlight: lp855x: Drop ret variable in brightness change function Artur Weber
@ 2023-08-09 16:38 ` Daniel Thompson
  2023-08-15 19:09 ` Nathan Chancellor
  2023-08-18 15:38 ` (subset) " Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Thompson @ 2023-08-09 16:38 UTC (permalink / raw)
  To: Artur Weber
  Cc: Lee Jones, Jingoo Han, Helge Deller, dri-devel, linux-fbdev,
	linux-kernel, kernel test robot

On Wed, Aug 09, 2023 at 01:42:16PM +0200, Artur Weber wrote:
> 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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] backlight: lp855x: Drop ret variable in brightness change function
  2023-08-09 11:42 [PATCH] backlight: lp855x: Drop ret variable in brightness change function Artur Weber
  2023-08-09 16:38 ` Daniel Thompson
@ 2023-08-15 19:09 ` Nathan Chancellor
  2023-08-18 15:38 ` (subset) " Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2023-08-15 19:09 UTC (permalink / raw)
  To: Artur Weber
  Cc: Lee Jones, Daniel Thompson, Jingoo Han, Helge Deller, dri-devel,
	linux-fbdev, linux-kernel, kernel test robot

On Wed, Aug 09, 2023 at 01:42:16PM +0200, Artur Weber wrote:
> 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: Nathan Chancellor <nathan@kernel.org>

> ---
>  drivers/video/backlight/lp855x_bl.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
> index 61a7f45bfad8..da1f124db69c 100644
> --- a/drivers/video/backlight/lp855x_bl.c
> +++ b/drivers/video/backlight/lp855x_bl.c
> @@ -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
> -- 
> 2.41.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: (subset) [PATCH] backlight: lp855x: Drop ret variable in brightness change function
  2023-08-09 11:42 [PATCH] backlight: lp855x: Drop ret variable in brightness change function Artur Weber
  2023-08-09 16:38 ` Daniel Thompson
  2023-08-15 19:09 ` Nathan Chancellor
@ 2023-08-18 15:38 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2023-08-18 15:38 UTC (permalink / raw)
  To: Lee Jones, Artur Weber
  Cc: Daniel Thompson, Jingoo Han, Helge Deller, dri-devel, linux-fbdev,
	linux-kernel, kernel test robot

On Wed, 09 Aug 2023 13:42:16 +0200, Artur Weber wrote:
> 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 [李琼斯]


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-18 15:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-09 11:42 [PATCH] backlight: lp855x: Drop ret variable in brightness change function Artur Weber
2023-08-09 16:38 ` Daniel Thompson
2023-08-15 19:09 ` Nathan Chancellor
2023-08-18 15:38 ` (subset) " Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).