All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] pwm: renesas-tpu: Make use of dev_err_probe()
@ 2022-04-13  8:50 Uwe Kleine-König
  2022-04-13  8:50 ` [PATCH 2/6] pwm: renesas-tpu: Make use of devm functions Uwe Kleine-König
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Uwe Kleine-König @ 2022-04-13  8:50 UTC (permalink / raw)
  To: Laurent Pinchart, Simon Horman, Geert Uytterhoeven, Magnus Damm,
	Thierry Reding, Lee Jones
  Cc: linux-pwm, linux-renesas-soc, kernel

The added benefit is that the error code is mentioned in the error message
and its usage is a bit more compact than open coding it. This also
improves behaviour in case devm_clk_get() returns -EPROBE_DEFER.

While touching this code, consistenly start error messages with upper
case.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-renesas-tpu.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/pwm/pwm-renesas-tpu.c b/drivers/pwm/pwm-renesas-tpu.c
index 4381df90a527..c3ae78e37789 100644
--- a/drivers/pwm/pwm-renesas-tpu.c
+++ b/drivers/pwm/pwm-renesas-tpu.c
@@ -398,10 +398,8 @@ static int tpu_probe(struct platform_device *pdev)
 		return PTR_ERR(tpu->base);
 
 	tpu->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(tpu->clk)) {
-		dev_err(&pdev->dev, "cannot get clock\n");
-		return PTR_ERR(tpu->clk);
-	}
+	if (IS_ERR(tpu->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(tpu->clk), "Failed to get clock\n");
 
 	/* Initialize and register the device. */
 	platform_set_drvdata(pdev, tpu);
@@ -414,9 +412,8 @@ static int tpu_probe(struct platform_device *pdev)
 
 	ret = pwmchip_add(&tpu->chip);
 	if (ret < 0) {
-		dev_err(&pdev->dev, "failed to register PWM chip\n");
 		pm_runtime_disable(&pdev->dev);
-		return ret;
+		return dev_err_probe(&pdev->dev, ret, "Failed to register PWM chip\n");
 	}
 
 	return 0;

base-commit: 3123109284176b1532874591f7c81f3837bbdc17
-- 
2.35.1


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

end of thread, other threads:[~2022-04-20 10:27 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13  8:50 [PATCH 1/6] pwm: renesas-tpu: Make use of dev_err_probe() Uwe Kleine-König
2022-04-13  8:50 ` [PATCH 2/6] pwm: renesas-tpu: Make use of devm functions Uwe Kleine-König
2022-04-14  9:07   ` Geert Uytterhoeven
2022-04-13  8:50 ` [PATCH 3/6] pwm: renesas-tpu: Implement .apply() callback Uwe Kleine-König
2022-04-14  9:18   ` Geert Uytterhoeven
2022-04-14 12:16     ` Geert Uytterhoeven
2022-04-13  8:50 ` [PATCH 4/6] pwm: renesas-tpu: Rename variables to match the usual naming Uwe Kleine-König
2022-04-14  9:10   ` Geert Uytterhoeven
2022-04-13  8:50 ` [PATCH 5/6] pwm: renesas-tpu: Improve maths to compute register settings Uwe Kleine-König
2022-04-14 10:10   ` Geert Uytterhoeven
2022-04-20 10:27     ` Uwe Kleine-König
2022-04-13  8:50 ` [PATCH 6/6] pwm: renesas-tpu: Improve precision of period and duty_cycle calculation Uwe Kleine-König
2022-04-14 10:27   ` Geert Uytterhoeven
2022-04-19  7:41     ` Geert Uytterhoeven
2022-04-19  7:48     ` Uwe Kleine-König
2022-04-14  9:06 ` [PATCH 1/6] pwm: renesas-tpu: Make use of dev_err_probe() Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.