backlight: pwm_bl: Fix uninitialized variable
authorDaniel Thompson <daniel.thompson@linaro.org>
Wed, 25 Jul 2018 07:38:30 +0000 (08:38 +0100)
committerLee Jones <lee.jones@linaro.org>
Wed, 25 Jul 2018 08:09:59 +0000 (09:09 +0100)
Currently, if the DT does not define num-interpolated-steps then
num_steps is undefined and the interpolation code will deploy randomly.
Fix with a simple initialize to zero.

Fixes: 573fe6d1c25c ("backlight: pwm_bl: Linear interpolation between brightness-levels")
Reported-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/video/backlight/pwm_bl.c

index 9ee4c1b..bdfcc0a 100644 (file)
@@ -250,7 +250,7 @@ static int pwm_backlight_parse_dt(struct device *dev,
        struct device_node *node = dev->of_node;
        unsigned int num_levels = 0;
        unsigned int levels_count;
-       unsigned int num_steps;
+       unsigned int num_steps = 0;
        struct property *prop;
        unsigned int *table;
        int length;