Skip to content

Commit ab47505

Browse files
flavio-suligoilag-linaro
authored andcommitted
backlight: mp3309c: Fix uninitialized local variable
In the function "pm3309c_parse_dt_node", when the dimming analog control mode (by I2C messages) is enabled, the local variable "prop_levels" is tested without any initialization, as indicated by the following smatch warning: drivers/video/backlight/mp3309c.c:279 pm3309c_parse_dt_node() error: uninitialized symbol 'prop_levels'. To avoid any problem in case of undefined behavior, we need to initialize it to "NULL". Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/dri-devel/af0a1870-693b-442f-9b11-0503cfcd944a@moroto.mountain/ Fixes: 2e91451 ("backlight: mp3309c: Add support for MPS MP3309C") Signed-off-by: Flavio Suligoi <f.suligoi@asem.it> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20231129164514.2772719-1-f.suligoi@asem.it Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 58793f2 commit ab47505

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/video/backlight/mp3309c.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ static int pm3309c_parse_dt_node(struct mp3309c_chip *chip,
203203
struct mp3309c_platform_data *pdata)
204204
{
205205
struct device_node *node = chip->dev->of_node;
206-
struct property *prop_pwms, *prop_levels;
206+
struct property *prop_pwms;
207+
struct property *prop_levels = NULL;
207208
int length = 0;
208209
int ret, i;
209210
unsigned int num_levels, tmp_value;

0 commit comments

Comments
 (0)