diff mbox series

fpga: xilinx-pr-decoupler: Simplify code by using dev_err_probe()

Message ID 666708105c25ae5fa7bb23b5eabd7d12fe9cb1b3.1612445770.git.michal.simek@xilinx.com (mailing list archive)
State New, archived
Headers show
Series fpga: xilinx-pr-decoupler: Simplify code by using dev_err_probe() | expand

Commit Message

Michal Simek Feb. 4, 2021, 1:36 p.m. UTC
Use already prepared dev_err_probe() introduced by commit a787e5400a1c
("driver core: add device probe log helper").
It simplifies EPROBE_DEFER handling.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/fpga/xilinx-pr-decoupler.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Moritz Fischer Feb. 6, 2021, 8:32 p.m. UTC | #1
On Thu, Feb 04, 2021 at 02:36:11PM +0100, Michal Simek wrote:
> Use already prepared dev_err_probe() introduced by commit a787e5400a1c
> ("driver core: add device probe log helper").
> It simplifies EPROBE_DEFER handling.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
>  drivers/fpga/xilinx-pr-decoupler.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/fpga/xilinx-pr-decoupler.c b/drivers/fpga/xilinx-pr-decoupler.c
> index 7d69af230567..b0eaf26af6e7 100644
> --- a/drivers/fpga/xilinx-pr-decoupler.c
> +++ b/drivers/fpga/xilinx-pr-decoupler.c
> @@ -100,11 +100,9 @@ static int xlnx_pr_decoupler_probe(struct platform_device *pdev)
>  		return PTR_ERR(priv->io_base);
>  
>  	priv->clk = devm_clk_get(&pdev->dev, "aclk");
> -	if (IS_ERR(priv->clk)) {
> -		if (PTR_ERR(priv->clk) != -EPROBE_DEFER)
> -			dev_err(&pdev->dev, "input clock not found\n");
> -		return PTR_ERR(priv->clk);
> -	}
> +	if (IS_ERR(priv->clk))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk),
> +				     "input clock not found\n");
>  
>  	err = clk_prepare_enable(priv->clk);
>  	if (err) {
> -- 
> 2.30.0
> 
Looks good, will queue.

- Moritz
Moritz Fischer March 6, 2021, 3:41 p.m. UTC | #2
On Thu, Feb 04, 2021 at 02:36:11PM +0100, Michal Simek wrote:
> Use already prepared dev_err_probe() introduced by commit a787e5400a1c
> ("driver core: add device probe log helper").
> It simplifies EPROBE_DEFER handling.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
> 
>  drivers/fpga/xilinx-pr-decoupler.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/fpga/xilinx-pr-decoupler.c b/drivers/fpga/xilinx-pr-decoupler.c
> index 7d69af230567..b0eaf26af6e7 100644
> --- a/drivers/fpga/xilinx-pr-decoupler.c
> +++ b/drivers/fpga/xilinx-pr-decoupler.c
> @@ -100,11 +100,9 @@ static int xlnx_pr_decoupler_probe(struct platform_device *pdev)
>  		return PTR_ERR(priv->io_base);
>  
>  	priv->clk = devm_clk_get(&pdev->dev, "aclk");
> -	if (IS_ERR(priv->clk)) {
> -		if (PTR_ERR(priv->clk) != -EPROBE_DEFER)
> -			dev_err(&pdev->dev, "input clock not found\n");
> -		return PTR_ERR(priv->clk);
> -	}
> +	if (IS_ERR(priv->clk))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk),
> +				     "input clock not found\n");
>  
>  	err = clk_prepare_enable(priv->clk);
>  	if (err) {
> -- 
> 2.30.0
> 
Applied to for-5.13,

Thanks
diff mbox series

Patch

diff --git a/drivers/fpga/xilinx-pr-decoupler.c b/drivers/fpga/xilinx-pr-decoupler.c
index 7d69af230567..b0eaf26af6e7 100644
--- a/drivers/fpga/xilinx-pr-decoupler.c
+++ b/drivers/fpga/xilinx-pr-decoupler.c
@@ -100,11 +100,9 @@  static int xlnx_pr_decoupler_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->io_base);
 
 	priv->clk = devm_clk_get(&pdev->dev, "aclk");
-	if (IS_ERR(priv->clk)) {
-		if (PTR_ERR(priv->clk) != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "input clock not found\n");
-		return PTR_ERR(priv->clk);
-	}
+	if (IS_ERR(priv->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk),
+				     "input clock not found\n");
 
 	err = clk_prepare_enable(priv->clk);
 	if (err) {