linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/3] pwm: imx-tpm: Use dev_err_probe() to simplify error handling
@ 2020-08-11  6:24 Anson Huang
  2020-08-11  6:24 ` [PATCH V2 2/3] pwm: imx27: " Anson Huang
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Anson Huang @ 2020-08-11  6:24 UTC (permalink / raw)
  To: thierry.reding, u.kleine-koenig, lee.jones, shawnguo, s.hauer,
	kernel, festevam, linux-pwm, 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>
---
changes since V1:
	- remove redundant return value print.
---
 drivers/pwm/pwm-imx-tpm.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c
index fcdf6be..aaf629b 100644
--- a/drivers/pwm/pwm-imx-tpm.c
+++ b/drivers/pwm/pwm-imx-tpm.c
@@ -350,13 +350,9 @@ static int pwm_imx_tpm_probe(struct platform_device *pdev)
 		return PTR_ERR(tpm->base);
 
 	tpm->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(tpm->clk)) {
-		ret = PTR_ERR(tpm->clk);
-		if (ret != -EPROBE_DEFER)
-			dev_err(&pdev->dev,
-				"failed to get PWM clock: %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(tpm->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(tpm->clk),
+				     "failed to get PWM clock\n");
 
 	ret = clk_prepare_enable(tpm->clk);
 	if (ret) {
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-11-11 18:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-11  6:24 [PATCH V2 1/3] pwm: imx-tpm: Use dev_err_probe() to simplify error handling Anson Huang
2020-08-11  6:24 ` [PATCH V2 2/3] pwm: imx27: " Anson Huang
2020-08-11  6:37   ` Lee Jones
2020-08-11  7:00   ` Uwe Kleine-König
2020-08-11  6:24 ` [PATCH V2 3/3] pwm: imx1: " Anson Huang
2020-08-11  6:37   ` Lee Jones
2020-08-11  6:58   ` Uwe Kleine-König
2020-08-11  6:37 ` [PATCH V2 1/3] pwm: imx-tpm: " Lee Jones
2020-08-11  7:00 ` Uwe Kleine-König
2020-09-17  6:37 ` Anson Huang
2020-11-11 18:05 ` 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).