linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: imx: Use dev_err_probe() to simplify error handling
@ 2020-08-12  3:45 Anson Huang
  2020-08-12  5:39 ` Oleksij Rempel
  2020-09-09  8:33 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Anson Huang @ 2020-08-12  3:45 UTC (permalink / raw)
  To: linux, kernel, shawnguo, s.hauer, festevam, linux-i2c,
	linux-arm-kernel, linux-kernel
  Cc: Linux-imx

dev_err_probe() can reduce code size, uniform error handling and record the
defer probe reason etc., use it to simplify the code.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 drivers/i2c/busses/i2c-imx.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 0ab5381..63f4367 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1159,11 +1159,9 @@ static int i2c_imx_probe(struct platform_device *pdev)
 
 	/* Get I2C clock */
 	i2c_imx->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(i2c_imx->clk)) {
-		if (PTR_ERR(i2c_imx->clk) != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "can't get I2C clock\n");
-		return PTR_ERR(i2c_imx->clk);
-	}
+	if (IS_ERR(i2c_imx->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(i2c_imx->clk),
+				     "can't get I2C clock\n");
 
 	ret = clk_prepare_enable(i2c_imx->clk);
 	if (ret) {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2c: imx: Use dev_err_probe() to simplify error handling
  2020-08-12  3:45 [PATCH] i2c: imx: Use dev_err_probe() to simplify error handling Anson Huang
@ 2020-08-12  5:39 ` Oleksij Rempel
  2020-09-09  8:33 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Oleksij Rempel @ 2020-08-12  5:39 UTC (permalink / raw)
  To: Anson Huang
  Cc: linux, kernel, shawnguo, s.hauer, festevam, linux-i2c,
	linux-arm-kernel, linux-kernel, Linux-imx

[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]

On Wed, Aug 12, 2020 at 11:45:54AM +0800, Anson Huang wrote:
> dev_err_probe() can reduce code size, uniform error handling and record the
> defer probe reason etc., use it to simplify the code.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
>  drivers/i2c/busses/i2c-imx.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 0ab5381..63f4367 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1159,11 +1159,9 @@ static int i2c_imx_probe(struct platform_device *pdev)
>  
>  	/* Get I2C clock */
>  	i2c_imx->clk = devm_clk_get(&pdev->dev, NULL);
> -	if (IS_ERR(i2c_imx->clk)) {
> -		if (PTR_ERR(i2c_imx->clk) != -EPROBE_DEFER)
> -			dev_err(&pdev->dev, "can't get I2C clock\n");
> -		return PTR_ERR(i2c_imx->clk);
> -	}
> +	if (IS_ERR(i2c_imx->clk))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(i2c_imx->clk),
> +				     "can't get I2C clock\n");
>  
>  	ret = clk_prepare_enable(i2c_imx->clk);
>  	if (ret) {
> -- 

Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2c: imx: Use dev_err_probe() to simplify error handling
  2020-08-12  3:45 [PATCH] i2c: imx: Use dev_err_probe() to simplify error handling Anson Huang
  2020-08-12  5:39 ` Oleksij Rempel
@ 2020-09-09  8:33 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2020-09-09  8:33 UTC (permalink / raw)
  To: Anson Huang
  Cc: linux, kernel, shawnguo, s.hauer, festevam, linux-i2c,
	linux-arm-kernel, linux-kernel, Linux-imx

[-- Attachment #1: Type: text/plain, Size: 288 bytes --]

On Wed, Aug 12, 2020 at 11:45:54AM +0800, Anson Huang wrote:
> dev_err_probe() can reduce code size, uniform error handling and record the
> defer probe reason etc., use it to simplify the code.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-09  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12  3:45 [PATCH] i2c: imx: Use dev_err_probe() to simplify error handling Anson Huang
2020-08-12  5:39 ` Oleksij Rempel
2020-09-09  8:33 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).