Skip to content

Commit 6eb3af7

Browse files
Uwe Kleine-Königthierryreding
authored andcommitted
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 <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent daa986d commit 6eb3af7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/pwm/pwm-renesas-tpu.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,8 @@ static int tpu_probe(struct platform_device *pdev)
398398
return PTR_ERR(tpu->base);
399399

400400
tpu->clk = devm_clk_get(&pdev->dev, NULL);
401-
if (IS_ERR(tpu->clk)) {
402-
dev_err(&pdev->dev, "cannot get clock\n");
403-
return PTR_ERR(tpu->clk);
404-
}
401+
if (IS_ERR(tpu->clk))
402+
return dev_err_probe(&pdev->dev, PTR_ERR(tpu->clk), "Failed to get clock\n");
405403

406404
/* Initialize and register the device. */
407405
platform_set_drvdata(pdev, tpu);
@@ -414,9 +412,8 @@ static int tpu_probe(struct platform_device *pdev)
414412

415413
ret = pwmchip_add(&tpu->chip);
416414
if (ret < 0) {
417-
dev_err(&pdev->dev, "failed to register PWM chip\n");
418415
pm_runtime_disable(&pdev->dev);
419-
return ret;
416+
return dev_err_probe(&pdev->dev, ret, "Failed to register PWM chip\n");
420417
}
421418

422419
return 0;

0 commit comments

Comments
 (0)