pwm: renesas-tpu: Make use of dev_err_probe()

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>
This commit is contained in:
Uwe Kleine-König 2022-04-20 14:12:35 +02:00 committed by Thierry Reding
parent daa986d5f8
commit 6eb3af76ad

View File

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