提交 63378673 编写于 作者: D Daniel Thompson 提交者: Lee Jones

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: 573fe6d1 ("backlight: pwm_bl: Linear interpolation between brightness-levels")
Reported-by: NMarcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: NDaniel Thompson <daniel.thompson@linaro.org>
Tested-by: NMarcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: NDouglas Anderson <dianders@chromium.org>
Signed-off-by: NLee Jones <lee.jones@linaro.org>
上级 858c5dfc
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册