[PATCH] leds: leds-lp5521/3: fix uninitialized variable ret

From: Dongliang Mu
Date: Fri Nov 18 2022 - 21:36:27 EST


Smatch reports the following uninitialized symbols:

drivers/leds/leds-lp5521.c:368 lp5521_multicolor_brightness()
error: uninitialized symbol 'ret'.
drivers/leds/leds-lp5523.c:811 lp5523_multicolor_brightness()
error: uninitialized symbol 'ret'.

Fix these issues by initializing ret with zero value.

Signed-off-by: Dongliang Mu <dzm91@xxxxxxxxxxx>
---
drivers/leds/leds-lp5521.c | 2 +-
drivers/leds/leds-lp5523.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index 7ff20c260504..cef46a8b4cab 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -352,7 +352,7 @@ static int lp5521_run_selftest(struct lp55xx_chip *chip, char *buf)
static int lp5521_multicolor_brightness(struct lp55xx_led *led)
{
struct lp55xx_chip *chip = led->chip;
- int ret;
+ int ret = 0;
int i;

mutex_lock(&chip->lock);
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index 369d40b0b65b..e0387639946e 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -795,7 +795,7 @@ static ssize_t store_master_fader_leds(struct device *dev,
static int lp5523_multicolor_brightness(struct lp55xx_led *led)
{
struct lp55xx_chip *chip = led->chip;
- int ret;
+ int ret = 0;
int i;

mutex_lock(&chip->lock);
--
2.34.1