Skip to content

Commit

Permalink
backlight: pwm_bl: Fix uninitialized variable
Browse files Browse the repository at this point in the history
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: 573fe6d ("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>
  • Loading branch information
Daniel Thompson authored and Lee Jones committed Jul 25, 2018
1 parent 858c5df commit 6337867
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/video/backlight/pwm_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6337867

Please sign in to comment.