Skip to content

Commit

Permalink
pwm: renesas-tpu: Make use of dev_err_probe()
Browse files Browse the repository at this point in the history
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, consistently start error messages with upper
case.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
  • Loading branch information
Uwe Kleine-König authored and Thierry Reding committed May 20, 2022
1 parent daa986d commit 6eb3af7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/pwm/pwm-renesas-tpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 6eb3af7

Please sign in to comment.