linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATH v5] pwm: rockchip: Convert to use dev_err_probe()
@ 2022-08-22  8:18 zhaoxiao
  2022-09-14 19:50 ` Uwe Kleine-König
  2022-09-28 12:01 ` Thierry Reding
  0 siblings, 2 replies; 3+ messages in thread
From: zhaoxiao @ 2022-08-22  8:18 UTC (permalink / raw)
  To: thierry.reding, heiko
  Cc: u.kleine-koenig, linux-pwm, linux-arm-kernel, linux-rockchip,
	linux-kernel, zhaoxiao

It's fine to call dev_err_probe() in ->probe() when error code is known.
Convert the driver to use dev_err_probe().

Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
---
 v5: delete the redundant ret and %d.
 drivers/pwm/pwm-rockchip.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c
index f3647b317152..a5af859217c1 100644
--- a/drivers/pwm/pwm-rockchip.c
+++ b/drivers/pwm/pwm-rockchip.c
@@ -328,22 +328,16 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
 	else
 		pc->pclk = pc->clk;
 
-	if (IS_ERR(pc->pclk)) {
-		ret = PTR_ERR(pc->pclk);
-		if (ret != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "Can't get APB clk: %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(pc->pclk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(pc->pclk), "Can't get APB clk\n");
 
 	ret = clk_prepare_enable(pc->clk);
-	if (ret) {
-		dev_err(&pdev->dev, "Can't prepare enable PWM clk: %d\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret, "Can't prepare enable PWM clk\n");
 
 	ret = clk_prepare_enable(pc->pclk);
 	if (ret) {
-		dev_err(&pdev->dev, "Can't prepare enable APB clk: %d\n", ret);
+		dev_err_probe(&pdev->dev, ret, "Can't prepare enable APB clk\n");
 		goto err_clk;
 	}
 
@@ -360,7 +354,7 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
 
 	ret = pwmchip_add(&pc->chip);
 	if (ret < 0) {
-		dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret);
+		dev_err_probe(&pdev->dev, ret, "pwmchip_add() failed\n");
 		goto err_pclk;
 	}
 
-- 
2.20.1


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

* Re: [PATH v5] pwm: rockchip: Convert to use dev_err_probe()
  2022-08-22  8:18 [PATH v5] pwm: rockchip: Convert to use dev_err_probe() zhaoxiao
@ 2022-09-14 19:50 ` Uwe Kleine-König
  2022-09-28 12:01 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2022-09-14 19:50 UTC (permalink / raw)
  To: zhaoxiao
  Cc: thierry.reding, heiko, linux-pwm, linux-arm-kernel,
	linux-rockchip, linux-kernel

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


On Mon, Aug 22, 2022 at 04:18:48PM +0800, zhaoxiao wrote:
> It's fine to call dev_err_probe() in ->probe() when error code is known.
> Convert the driver to use dev_err_probe().
> 
> Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>

Looks fine now:

Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

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

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

* Re: [PATH v5] pwm: rockchip: Convert to use dev_err_probe()
  2022-08-22  8:18 [PATH v5] pwm: rockchip: Convert to use dev_err_probe() zhaoxiao
  2022-09-14 19:50 ` Uwe Kleine-König
@ 2022-09-28 12:01 ` Thierry Reding
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2022-09-28 12:01 UTC (permalink / raw)
  To: zhaoxiao
  Cc: heiko, u.kleine-koenig, linux-pwm, linux-arm-kernel,
	linux-rockchip, linux-kernel

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

On Mon, Aug 22, 2022 at 04:18:48PM +0800, zhaoxiao wrote:
> It's fine to call dev_err_probe() in ->probe() when error code is known.
> Convert the driver to use dev_err_probe().
> 
> Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com>
> ---
>  v5: delete the redundant ret and %d.
>  drivers/pwm/pwm-rockchip.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)

Applied, thanks.

Thierry

[-- 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:[~2022-09-28 12:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-22  8:18 [PATH v5] pwm: rockchip: Convert to use dev_err_probe() zhaoxiao
2022-09-14 19:50 ` Uwe Kleine-König
2022-09-28 12:01 ` Thierry Reding

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).