Skip to contentSkip to conversation

media: omap3isp: add checks for devm_regulator_get

PATCH In review Chuhong Yuan 2 participants 2 messages Dec 10, 2019 – Dec 12, 2019 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: omap3isp: add checks for devm_regulator_get

The driver misses checks for devm_regulator_get(). Add checks to fix it.

---
 drivers/media/platform/omap3isp/isp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/media/platform/omap3isp/isp.c +9 -0
index 327c5716922a..ef3502182c3a 100644
@@ -2312,7 +2312,16 @@ static int isp_probe(struct platform_device *pdev)
 
 	/* Regulators */
 	isp->isp_csiphy1.vdd = devm_regulator_get(&pdev->dev, "vdd-csiphy1");
+	if (IS_ERR(isp->isp_csiphy1.vdd)) {
+		ret = PTR_ERR(isp->isp_csiphy1.vdd);
+		goto error;
+	}
+
 	isp->isp_csiphy2.vdd = devm_regulator_get(&pdev->dev, "vdd-csiphy2");
+	if (IS_ERR(isp->isp_csiphy2.vdd)) {
+		ret = PTR_ERR(isp->isp_csiphy2.vdd);
+		goto error;
+	}
 
 	/* Clocks
 	 *
Signature · 1 line
2.24.0
#1 lore raw

Hi Chuhong,

(CC'ing Sakari Ailus)

Thank you for the patch.

Quoted 16 lines · Chuhong Yuan

The driver misses checks for devm_regulator_get(). Add checks to fix it.

---
 drivers/media/platform/omap3isp/isp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/media/platform/omap3isp/isp.c +0 -0
index 327c5716922a..ef3502182c3a 100644
@@ -2312,7 +2312,16 @@ static int isp_probe(struct platform_device *pdev)
 
 	/* Regulators */
 	isp->isp_csiphy1.vdd = devm_regulator_get(&pdev->dev, "vdd-csiphy1");

drivers/media/platform/omap3isp/isp.c static int isp_probe(struct platform_device *pdev) · line 2324

Quoted 10 lines
drivers/media/platform/omap3isp/isp.c +9 -0
+	if (IS_ERR(isp->isp_csiphy1.vdd)) {
+		ret = PTR_ERR(isp->isp_csiphy1.vdd);
+		goto error;
+	}
+
 	isp->isp_csiphy2.vdd = devm_regulator_get(&pdev->dev, "vdd-csiphy2");
+	if (IS_ERR(isp->isp_csiphy2.vdd)) {
+		ret = PTR_ERR(isp->isp_csiphy2.vdd);
+		goto error;
+	}

Those regulators are currently checked at runtime in omap3isp_csiphy_acquire(). The check is incorrect as it checks for NULL while vdd would contain an ERR_PTR, so there's a real issue. However, not all platforms support the CSI-2 receivers, and only omap3-n950.dts and omap3-n9.dts provide the regulators. They thus need to be kept optional.

Would you like to provide another patch that fixes the checks in omap3isp_csiphy_acquire() ?

Quoted 3 lines
drivers/media/platform/omap3isp/isp.c +0 -0
 	/* Clocks
 	 *
Signature · 3 lines
Regards,

Laurent Pinchart