aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2018-07-25 08:38:30 +0100
committerLee Jones <lee.jones@linaro.org>2018-07-25 09:09:59 +0100
commit633786736ed53a53b8d0a630cc3ff57381027081 (patch)
tree823842fd94484802c4965fa12ac9a057bd7cdb2f /drivers/video/backlight
parentbacklight: adp8860: Mark expected switch fall-through (diff)
downloadlinux-dev-633786736ed53a53b8d0a630cc3ff57381027081.tar.xz
linux-dev-633786736ed53a53b8d0a630cc3ff57381027081.zip
backlight: pwm_bl: Fix uninitialized variable
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>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r--drivers/video/backlight/pwm_bl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 9ee4c1b735b2..bdfcc0a71db1 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -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;