[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231128150839.2605003-1-f.suligoi@asem.it>
Date: Tue, 28 Nov 2023 16:08:39 +0100
From: Flavio Suligoi <f.suligoi@...m.it>
To: Lee Jones <lee@...nel.org>,
Daniel Thompson <daniel.thompson@...aro.org>,
Jingoo Han <jingoohan1@...il.com>,
Helge Deller <deller@....de>,
Dan Carpenter <dan.carpenter@...aro.org>
Cc: dri-devel@...ts.freedesktop.org, linux-fbdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Flavio Suligoi <f.suligoi@...m.it>
Subject: [PATCH] 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 (thanks to Dan Carpenter for the report):
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".
For consistency, I also initialize the other similar variable
"prop_pwms" in the same way.
Signed-off-by: Flavio Suligoi <f.suligoi@...m.it>
---
drivers/video/backlight/mp3309c.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/video/backlight/mp3309c.c b/drivers/video/backlight/mp3309c.c
index 3fe4469ef43f..733cad1dd15c 100644
--- a/drivers/video/backlight/mp3309c.c
+++ b/drivers/video/backlight/mp3309c.c
@@ -203,7 +203,8 @@ static int pm3309c_parse_dt_node(struct mp3309c_chip *chip,
struct mp3309c_platform_data *pdata)
{
struct device_node *node = chip->dev->of_node;
- struct property *prop_pwms, *prop_levels;
+ struct property *prop_pwms = NULL;
+ struct property *prop_levels = NULL;
int length = 0;
int ret, i;
unsigned int num_levels, tmp_value;
--
2.34.1
Powered by blists - more mailing lists