linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: omap3isp: add checks for devm_regulator_get
@ 2019-12-10  9:14 Chuhong Yuan
  2019-12-12 23:42 ` Laurent Pinchart
  0 siblings, 1 reply; 2+ messages in thread
From: Chuhong Yuan @ 2019-12-10  9:14 UTC (permalink / raw)
  Cc: Laurent Pinchart, Mauro Carvalho Chehab, linux-media,
	linux-kernel, Chuhong Yuan

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

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/media/platform/omap3isp/isp.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index 327c5716922a..ef3502182c3a 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -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
 	 *
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: omap3isp: add checks for devm_regulator_get
  2019-12-10  9:14 [PATCH] media: omap3isp: add checks for devm_regulator_get Chuhong Yuan
@ 2019-12-12 23:42 ` Laurent Pinchart
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2019-12-12 23:42 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: Mauro Carvalho Chehab, linux-media, linux-kernel

Hi Chuhong,

(CC'ing Sakari Ailus)

Thank you for the patch.

On Tue, Dec 10, 2019 at 05:14:28PM +0800, Chuhong Yuan wrote:
> The driver misses checks for devm_regulator_get().
> Add checks to fix it.
> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> ---
>  drivers/media/platform/omap3isp/isp.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
> index 327c5716922a..ef3502182c3a 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -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;
> +	}

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() ?

>  
>  	/* Clocks
>  	 *

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-12 23:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10  9:14 [PATCH] media: omap3isp: add checks for devm_regulator_get Chuhong Yuan
2019-12-12 23:42 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).