Skip to contentSkip to conversation

media: omap3isp: fix uninitialized variable use

PATCH In review Arnd Bergmann 4 participants 4 messages Aug 23, 2017 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: omap3isp: fix uninitialized variable use

A debug printk statement was copied incorrectly into the new csi1 parser code and causes a warning there:

drivers/media/platform/omap3isp/isp.c: In function 'isp_probe':
include/linux/dynamic_debug.h:134:3: error: 'i' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Since there is only one lane, the index is never set. This changes the debug print to always print a zero instead, keeping the original format of the message.

Fixes 9211434bad30 ("media: omap3isp: Parse CSI1 configuration from the device tree")
---
 drivers/media/platform/omap3isp/isp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/omap3isp/isp.c +1 -1
index 83aea08b832d..30c825bf80d9 100644
@@ -2092,7 +2092,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
 			buscfg->bus.ccp2.lanecfg.data[0].pol =
 				vep.bus.mipi_csi1.lane_polarity[1];
 
-			dev_dbg(dev, "data lane %u polarity %u, pos %u\n", i,
+			dev_dbg(dev, "data lane 0 polarity %u, pos %u\n",
 				buscfg->bus.ccp2.lanecfg.data[0].pol,
 				buscfg->bus.ccp2.lanecfg.data[0].pos);
 
Signature · 1 line
2.9.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Arnd,

Thank you for the patch.

Quoted 7 lines · On Wednesday, 23 August 2017 16:30:19 EEST Arnd Bergmann wrote:

A debug printk statement was copied incorrectly into the new csi1 parser code and causes a warning there:

drivers/media/platform/omap3isp/isp.c: In function 'isp_probe':
include/linux/dynamic_debug.h:134:3: error: 'i' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Quoted 7 lines

Since there is only one lane, the index is never set. This changes the debug print to always print a zero instead, keeping the original format of the message.

Fixes 9211434bad30 ("media: omap3isp: Parse CSI1 configuration from the

device tree")

Quoted 17 lines
---
 drivers/media/platform/omap3isp/isp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/media/platform/omap3isp/isp.c index 83aea08b832d..30c825bf80d9 100644

drivers/media/platform/omap3isp/isp.c +0 -0
@@ -2092,7 +2092,7 @@ static int isp_fwnode_parse(struct device *dev, struct

fwnode_handle *fwnode, buscfg->bus.ccp2.lanecfg.data[0].pol =

drivers/media/platform/omap3isp/isp.c +1 -1
 				vep.bus.mipi_csi1.lane_polarity[1];
 
-			dev_dbg(dev, "data lane %u polarity %u, pos %u\n", i,
+			dev_dbg(dev, "data lane 0 polarity %u, pos %u\n",
 				buscfg->bus.ccp2.lanecfg.data[0].pol,
 				buscfg->bus.ccp2.lanecfg.data[0].pos);
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw
In reply to Arnd Bergmann

Hi Arnd,

Quoted 21 lines · Arnd Bergmann

A debug printk statement was copied incorrectly into the new csi1 parser code and causes a warning there:

drivers/media/platform/omap3isp/isp.c: In function 'isp_probe':
include/linux/dynamic_debug.h:134:3: error: 'i' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Since there is only one lane, the index is never set. This changes the debug print to always print a zero instead, keeping the original format of the message.

Fixes 9211434bad30 ("media: omap3isp: Parse CSI1 configuration from the device tree")
---
 drivers/media/platform/omap3isp/isp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/omap3isp/isp.c +0 -0
index 83aea08b832d..30c825bf80d9 100644

drivers/media/platform/omap3isp/isp.c static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode, · line 2098

Quoted 8 lines
drivers/media/platform/omap3isp/isp.c +1 -1
@@ -2092,7 +2092,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
 			buscfg->bus.ccp2.lanecfg.data[0].pol =
 				vep.bus.mipi_csi1.lane_polarity[1];
 
-			dev_dbg(dev, "data lane %u polarity %u, pos %u\n", i,
+			dev_dbg(dev, "data lane 0 polarity %u, pos %u\n",
 				buscfg->bus.ccp2.lanecfg.data[0].pol,
 				buscfg->bus.ccp2.lanecfg.data[0].pos);
 

Thanks! I removed "0 "; CCP2 always has a single lane. The patch is now:

drivers/media/platform/omap3isp/isp.c +1 -1
index 83aea08b832d..1a428fe9f070 100644
@@ -2092,7 +2092,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
 			buscfg->bus.ccp2.lanecfg.data[0].pol =
 				vep.bus.mipi_csi1.lane_polarity[1];
 
-			dev_dbg(dev, "data lane %u polarity %u, pos %u\n", i,
+			dev_dbg(dev, "data lane polarity %u, pos %u\n",
 				buscfg->bus.ccp2.lanecfg.data[0].pol,
 				buscfg->bus.ccp2.lanecfg.data[0].pos);
 
Signature · 2 lines
Sakari Ailus
e-mail: [email protected]
Reviewed-by
#3 lore raw

Hi,

Quoted 38 lines · Sakari Ailus
Quoted 21 lines · Arnd Bergmann

A debug printk statement was copied incorrectly into the new csi1 parser code and causes a warning there:

drivers/media/platform/omap3isp/isp.c: In function 'isp_probe':
include/linux/dynamic_debug.h:134:3: error: 'i' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Since there is only one lane, the index is never set. This changes the debug print to always print a zero instead, keeping the original format of the message.

Fixes 9211434bad30 ("media: omap3isp: Parse CSI1 configuration from the device tree")
---
 drivers/media/platform/omap3isp/isp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/omap3isp/isp.c +0 -0
index 83aea08b832d..30c825bf80d9 100644

drivers/media/platform/omap3isp/isp.c static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode, · line 2098

Quoted 8 lines
drivers/media/platform/omap3isp/isp.c +1 -1
@@ -2092,7 +2092,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
 			buscfg->bus.ccp2.lanecfg.data[0].pol =
 				vep.bus.mipi_csi1.lane_polarity[1];
 
-			dev_dbg(dev, "data lane %u polarity %u, pos %u\n", i,
+			dev_dbg(dev, "data lane 0 polarity %u, pos %u\n",
 				buscfg->bus.ccp2.lanecfg.data[0].pol,
 				buscfg->bus.ccp2.lanecfg.data[0].pos);
 

Thanks! I removed "0 "; CCP2 always has a single lane. The patch is now:

drivers/media/platform/omap3isp/isp.c +0 -0
index 83aea08b832d..1a428fe9f070 100644

drivers/media/platform/omap3isp/isp.c static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode, · line 2097

Quoted 7 lines
drivers/media/platform/omap3isp/isp.c +1 -1
@@ -2092,7 +2092,7 @@ static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
 			buscfg->bus.ccp2.lanecfg.data[0].pol =
 				vep.bus.mipi_csi1.lane_polarity[1];
 
-			dev_dbg(dev, "data lane %u polarity %u, pos %u\n", i,
+			dev_dbg(dev, "data lane polarity %u, pos %u\n",
 				buscfg->bus.ccp2.lanecfg.data[0].pol,
 				buscfg->bus.ccp2.lanecfg.data[0].pos);

-- Sebastian