diff mbox series

pwm: jz4740: Don't use dev_err_probe() in .request()

Message ID 20240106141302.1253365-2-u.kleine-koenig@pengutronix.de (mailing list archive)
State Handled Elsewhere
Headers show
Series pwm: jz4740: Don't use dev_err_probe() in .request() | expand

Commit Message

Uwe Kleine-König Jan. 6, 2024, 2:13 p.m. UTC
dev_err_probe() is only supposed to be used in probe functions. While it
probably doesn't hurt, both the EPROBE_DEFER handling and calling
device_set_deferred_probe_reason() are conceptually wrong in the request
callback. So replace the call by dev_err() and a separate return
statement.

This effectively reverts commit c0bfe9606e03 ("pwm: jz4740: Simplify
with dev_err_probe()").

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


base-commit: d73f444d06fb8a42a5c0623453f3ea1fe9880229

Comments

Krzysztof Kozlowski Jan. 6, 2024, 5:20 p.m. UTC | #1
On 06/01/2024 15:13, Uwe Kleine-König wrote:
> dev_err_probe() is only supposed to be used in probe functions. While it
> probably doesn't hurt, both the EPROBE_DEFER handling and calling
> device_set_deferred_probe_reason() are conceptually wrong in the request
> callback. So replace the call by dev_err() and a separate return
> statement.
> 
> This effectively reverts commit c0bfe9606e03 ("pwm: jz4740: Simplify
> with dev_err_probe()").

Too much automation :(

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Uwe Kleine-König Jan. 13, 2024, 8:26 a.m. UTC | #2
Hello,

On Sat, Jan 06, 2024 at 06:20:44PM +0100, Krzysztof Kozlowski wrote:
> On 06/01/2024 15:13, Uwe Kleine-König wrote:
> > dev_err_probe() is only supposed to be used in probe functions. While it
> > probably doesn't hurt, both the EPROBE_DEFER handling and calling
> > device_set_deferred_probe_reason() are conceptually wrong in the request
> > callback. So replace the call by dev_err() and a separate return
> > statement.
> > 
> > This effectively reverts commit c0bfe9606e03 ("pwm: jz4740: Simplify
> > with dev_err_probe()").
> 
> Too much automation :(
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

I added that patch to my for-next branch at
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next
with the intention to send it for inclusion in 6.8-rc after being in
next for a few days.

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index 80dcff237a15..3933418e551b 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -61,9 +61,10 @@  static int jz4740_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
 	snprintf(name, sizeof(name), "timer%u", pwm->hwpwm);
 
 	clk = clk_get(chip->dev, name);
-	if (IS_ERR(clk))
-		return dev_err_probe(chip->dev, PTR_ERR(clk),
-				     "Failed to get clock\n");
+	if (IS_ERR(clk)) {
+		dev_err(chip->dev, "error %pe: Failed to get clock\n", clk);
+		return PTR_ERR(clk);
+	}
 
 	err = clk_prepare_enable(clk);
 	if (err < 0) {