[-next,09/13] media: xilinx: csi2rxss: Switch to use dev_err_probe() helper

Message ID 20220915150324.688062-10-yangyingliang@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Sakari Ailus
Headers
Series media: Switch to use dev_err_probe() helper |

Commit Message

Yang Yingliang Sept. 15, 2022, 3:03 p.m. UTC
  In the probe path, dev_err() can be replace with dev_err_probe()
which will check if error code is -EPROBE_DEFER.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/media/platform/xilinx/xilinx-csi2rxss.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
  

Comments

Laurent Pinchart Sept. 19, 2022, 1:58 p.m. UTC | #1
Hi Yang,

Thank you for the patch.

On Thu, Sep 15, 2022 at 11:03:20PM +0800, Yang Yingliang wrote:
> In the probe path, dev_err() can be replace with dev_err_probe()
> which will check if error code is -EPROBE_DEFER.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/platform/xilinx/xilinx-csi2rxss.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/xilinx/xilinx-csi2rxss.c b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
> index 29b53febc2e7..080e2483cc92 100644
> --- a/drivers/media/platform/xilinx/xilinx-csi2rxss.c
> +++ b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
> @@ -976,11 +976,9 @@ static int xcsi2rxss_probe(struct platform_device *pdev)
>  	/* Reset GPIO */
>  	xcsi2rxss->rst_gpio = devm_gpiod_get_optional(dev, "video-reset",
>  						      GPIOD_OUT_HIGH);
> -	if (IS_ERR(xcsi2rxss->rst_gpio)) {
> -		if (PTR_ERR(xcsi2rxss->rst_gpio) != -EPROBE_DEFER)
> -			dev_err(dev, "Video Reset GPIO not setup in DT");
> -		return PTR_ERR(xcsi2rxss->rst_gpio);
> -	}
> +	if (IS_ERR(xcsi2rxss->rst_gpio))
> +		return dev_err_probe(dev, PTR_ERR(xcsi2rxss->rst_gpio),
> +				     "Video Reset GPIO not setup in DT");
>  
>  	ret = xcsi2rxss_parse_of(xcsi2rxss);
>  	if (ret < 0)
  
Laurent Pinchart Sept. 19, 2022, 2:07 p.m. UTC | #2
On Mon, Sep 19, 2022 at 04:58:54PM +0300, Laurent Pinchart wrote:
> Hi Yang,
> 
> Thank you for the patch.
> 
> On Thu, Sep 15, 2022 at 11:03:20PM +0800, Yang Yingliang wrote:
> > In the probe path, dev_err() can be replace with dev_err_probe()
> > which will check if error code is -EPROBE_DEFER.
> > 
> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> > ---
> >  drivers/media/platform/xilinx/xilinx-csi2rxss.c | 8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/media/platform/xilinx/xilinx-csi2rxss.c b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
> > index 29b53febc2e7..080e2483cc92 100644
> > --- a/drivers/media/platform/xilinx/xilinx-csi2rxss.c
> > +++ b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
> > @@ -976,11 +976,9 @@ static int xcsi2rxss_probe(struct platform_device *pdev)
> >  	/* Reset GPIO */
> >  	xcsi2rxss->rst_gpio = devm_gpiod_get_optional(dev, "video-reset",
> >  						      GPIOD_OUT_HIGH);
> > -	if (IS_ERR(xcsi2rxss->rst_gpio)) {
> > -		if (PTR_ERR(xcsi2rxss->rst_gpio) != -EPROBE_DEFER)
> > -			dev_err(dev, "Video Reset GPIO not setup in DT");
> > -		return PTR_ERR(xcsi2rxss->rst_gpio);
> > -	}
> > +	if (IS_ERR(xcsi2rxss->rst_gpio))
> > +		return dev_err_probe(dev, PTR_ERR(xcsi2rxss->rst_gpio),
> > +				     "Video Reset GPIO not setup in DT");

Actually, while at it, could you add the missing \n at the end of the
message ?

> >  
> >  	ret = xcsi2rxss_parse_of(xcsi2rxss);
> >  	if (ret < 0)
  

Patch

diff --git a/drivers/media/platform/xilinx/xilinx-csi2rxss.c b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
index 29b53febc2e7..080e2483cc92 100644
--- a/drivers/media/platform/xilinx/xilinx-csi2rxss.c
+++ b/drivers/media/platform/xilinx/xilinx-csi2rxss.c
@@ -976,11 +976,9 @@  static int xcsi2rxss_probe(struct platform_device *pdev)
 	/* Reset GPIO */
 	xcsi2rxss->rst_gpio = devm_gpiod_get_optional(dev, "video-reset",
 						      GPIOD_OUT_HIGH);
-	if (IS_ERR(xcsi2rxss->rst_gpio)) {
-		if (PTR_ERR(xcsi2rxss->rst_gpio) != -EPROBE_DEFER)
-			dev_err(dev, "Video Reset GPIO not setup in DT");
-		return PTR_ERR(xcsi2rxss->rst_gpio);
-	}
+	if (IS_ERR(xcsi2rxss->rst_gpio))
+		return dev_err_probe(dev, PTR_ERR(xcsi2rxss->rst_gpio),
+				     "Video Reset GPIO not setup in DT");
 
 	ret = xcsi2rxss_parse_of(xcsi2rxss);
 	if (ret < 0)