Skip to contentSkip to conversation

mt9v032: fix uninitialized variable warning

PATCH New Hans Verkuil 1 participant 1 message Jul 28, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mt9v032: fix uninitialized variable warning

drivers/media/i2c/mt9v032.c: In function ‘mt9v032_probe’:
CC [M] drivers/media/i2c/s5k4ecgx.o
drivers/media/i2c/mt9v032.c:996:20: warning: ‘pdata’ may be used uninitialized in this function [-Wmaybe-uninitialized]

  if (pdata && pdata->link_freqs) {
                    ^

It can indeed be uninitialized in one corner case. Initialize to NULL.

---
 drivers/media/i2c/mt9v032.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/mt9v032.c +1 -1
index 977f400..a68ce94 100644
@@ -882,7 +882,7 @@ static const struct regmap_config mt9v032_regmap_config = {
 static struct mt9v032_platform_data *
 mt9v032_get_pdata(struct i2c_client *client)
 {
-	struct mt9v032_platform_data *pdata;
+	struct mt9v032_platform_data *pdata = NULL;
 	struct v4l2_of_endpoint endpoint;
 	struct device_node *np;
 	struct property *prop;
Signature · 1 line
2.1.4