diff mbox series

[2/9] i2c: xiic: Simplify with dev_err_probe()

Message ID 20200902150643.14839-2-krzk@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/9] i2c: stm32: Simplify with dev_err_probe() | expand

Commit Message

Krzysztof Kozlowski Sept. 2, 2020, 3:06 p.m. UTC
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/i2c/busses/i2c-xiic.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Michal Simek June 23, 2021, 8:57 a.m. UTC | #1
st 2. 9. 2020 v 17:10 odesílatel Krzysztof Kozlowski <krzk@kernel.org> napsal:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and the error value gets printed.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  drivers/i2c/busses/i2c-xiic.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 90c1c362394d..a97438f35c5d 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -787,11 +787,10 @@ static int xiic_i2c_probe(struct platform_device *pdev)
>         init_waitqueue_head(&i2c->wait);
>
>         i2c->clk = devm_clk_get(&pdev->dev, NULL);
> -       if (IS_ERR(i2c->clk)) {
> -               if (PTR_ERR(i2c->clk) != -EPROBE_DEFER)
> -                       dev_err(&pdev->dev, "input clock not found.\n");
> -               return PTR_ERR(i2c->clk);
> -       }
> +       if (IS_ERR(i2c->clk))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk),
> +                                    "input clock not found.\n");
> +
>         ret = clk_prepare_enable(i2c->clk);
>         if (ret) {
>                 dev_err(&pdev->dev, "Unable to enable clock.\n");
> --
> 2.17.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

I see that this didn't go through.
Acked-by: Michal Simek <michal.simek@xilinx.com>

Wolfram: Can you please apply?

Thanks,
Michal
Wolfram Sang June 23, 2021, 4:26 p.m. UTC | #2
On Wed, Sep 02, 2020 at 05:06:36PM +0200, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and the error value gets printed.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 90c1c362394d..a97438f35c5d 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -787,11 +787,10 @@  static int xiic_i2c_probe(struct platform_device *pdev)
 	init_waitqueue_head(&i2c->wait);
 
 	i2c->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(i2c->clk)) {
-		if (PTR_ERR(i2c->clk) != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "input clock not found.\n");
-		return PTR_ERR(i2c->clk);
-	}
+	if (IS_ERR(i2c->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk),
+				     "input clock not found.\n");
+
 	ret = clk_prepare_enable(i2c->clk);
 	if (ret) {
 		dev_err(&pdev->dev, "Unable to enable clock.\n");