leds: rgb: leds-mt6370-rgb: Fix uninitialized variable 'ret' in mt6370_mc_pattern_clear
authorSuraj Sonawane <surajsonawane0215@gmail.com>
Wed, 16 Oct 2024 04:21:42 +0000 (09:51 +0530)
committerLee Jones <lee@kernel.org>
Wed, 16 Oct 2024 07:52:40 +0000 (08:52 +0100)
Fix the uninitialized symbol 'ret' in the function mt6370_mc_pattern_clear
to resolve the following warning:
drivers/leds/rgb/leds-mt6370-rgb.c:604 mt6370_mc_pattern_clear()
error: uninitialized symbol 'ret'.
Initialize 'ret' to 0 to prevent undefined behavior from uninitialized
access.

Signed-off-by: Suraj Sonawane <surajsonawane0215@gmail.com>
Link: https://lore.kernel.org/r/20241016042142.8088-1-surajsonawane0215@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/rgb/leds-mt6370-rgb.c

index fe76e8e..eafdfcf 100644 (file)
@@ -587,7 +587,7 @@ static inline int mt6370_mc_pattern_clear(struct led_classdev *lcdev)
        struct mt6370_led *led = container_of(mccdev, struct mt6370_led, mc);
        struct mt6370_priv *priv = led->priv;
        struct mc_subled *subled;
-       int i, ret;
+       int i, ret = 0;
 
        mutex_lock(&led->priv->lock);