diff mbox

[2/2] media: imx-media-csi: Do not propagate the error when pinctrl is not found

Message ID 1520018049-5216-2-git-send-email-festevam@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fabio Estevam March 2, 2018, 7:14 p.m. UTC
From: Fabio Estevam <fabio.estevam@nxp.com>

Since commit 52e17089d185 ("media: imx: Don't initialize vars that
won't be used") imx_csi_probe() fails to probe after propagating the
devm_pinctrl_get_select_default() error.

devm_pinctrl_get_select_default() may return -ENODEV when the CSI pinctrl
entry is not found, so better not to propagate the error in the -ENODEV
case to avoid a regression.

Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 drivers/staging/media/imx/imx-media-csi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Steve Longerbeam March 2, 2018, 11:50 p.m. UTC | #1
On 03/02/2018 11:14 AM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> Since commit 52e17089d185 ("media: imx: Don't initialize vars that
> won't be used") imx_csi_probe() fails to probe after propagating the
> devm_pinctrl_get_select_default() error.
>
> devm_pinctrl_get_select_default() may return -ENODEV when the CSI pinctrl
> entry is not found, so better not to propagate the error in the -ENODEV
> case to avoid a regression.
>
> Suggested-by: Philipp Zabel <p.zabel@pengutronix.de>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Reviewed-by: Steve Longerbeam <steve_longerbeam@mentor.com>

> ---
>   drivers/staging/media/imx/imx-media-csi.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
> index 4f290a0..5af66f6 100644
> --- a/drivers/staging/media/imx/imx-media-csi.c
> +++ b/drivers/staging/media/imx/imx-media-csi.c
> @@ -1799,7 +1799,10 @@ static int imx_csi_probe(struct platform_device *pdev)
>   	pinctrl = devm_pinctrl_get_select_default(priv->dev);
>   	if (IS_ERR(pinctrl)) {
>   		ret = PTR_ERR(pinctrl);
> -		goto free;
> +		dev_dbg(priv->dev,
> +			"devm_pinctrl_get_select_default() failed: %d", ret);
> +		if (ret != -ENODEV)
> +			goto free;
>   	}
>   
>   	ret = v4l2_async_register_subdev(&priv->sd);
diff mbox

Patch

diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
index 4f290a0..5af66f6 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -1799,7 +1799,10 @@  static int imx_csi_probe(struct platform_device *pdev)
 	pinctrl = devm_pinctrl_get_select_default(priv->dev);
 	if (IS_ERR(pinctrl)) {
 		ret = PTR_ERR(pinctrl);
-		goto free;
+		dev_dbg(priv->dev,
+			"devm_pinctrl_get_select_default() failed: %d", ret);
+		if (ret != -ENODEV)
+			goto free;
 	}
 
 	ret = v4l2_async_register_subdev(&priv->sd);