Skip to contentSkip to conversation

media: imx-media-csi: Fix inconsistent IS_ERR and PTR_ERR

PATCH Superseded Fabio Estevam 2 participants 3 messages Mar 2, 2018

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/2 media: imx-media-csi: Fix inconsistent IS_ERR and PTR_ERR

From: Gustavo A. R. Silva <[email protected]>

Fix inconsistent IS_ERR and PTR_ERR in imx_csi_probe. The proper pointer to be passed as argument is pinctrl instead of priv->vdev.

This issue was detected with the help of Coccinelle.

Fixes 52e17089d185 ("media: imx: Don't initialize vars that won't be used")
---
 drivers/staging/media/imx/imx-media-csi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-csi.c +1 -1
index 5a195f8..4f290a0 100644
@@ -1798,7 +1798,7 @@ static int imx_csi_probe(struct platform_device *pdev)
 	priv->dev->of_node = pdata->of_node;
 	pinctrl = devm_pinctrl_get_select_default(priv->dev);
 	if (IS_ERR(pinctrl)) {
-		ret = PTR_ERR(priv->vdev);
+		ret = PTR_ERR(pinctrl);
 		goto free;
 	}
 
Signature · 1 line
2.7.4
author reviewer
#1 lore raw

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

From: Fabio Estevam <[email protected]>

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.

---
 drivers/staging/media/imx/imx-media-csi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-csi.c +4 -1
index 4f290a0..5af66f6 100644
@@ -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);
Signature · 1 line
2.7.4
maintainer Reviewed-by on v1 2/2
#2 lore raw

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

Quoted 6 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

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.

Quoted 6 lines

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.

Quoted 20 lines
---
  drivers/staging/media/imx/imx-media-csi.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/media/imx/imx-media-csi.c +4 -1
index 4f290a0..5af66f6 100644
@@ -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);