Skip to contentSkip to conversation

staging: most: dim2: use dev_err_probe() for clock errors in rcar enable functions

PATCH New Batu Ada Tutkun 1 participant 1 message Jul 9

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 staging: most: dim2: use dev_err_probe() for clock errors in rcar enable functions

rcar_gen2_enable() and rcar_gen3_enable() use the old pattern of dev_err() followed by return PTR_ERR() when devm_clk_get() fails. fsl_mx6_enable() in the same file was already converted to use dev_err_probe() by a previous cleanup series.

Convert the remaining two functions for consistency. devm_clk_get() calls clk_get() which can return -EPROBE_DEFER if the clock provider has not yet registered. Using dev_err_probe() suppresses the log at error level in that case, avoiding misleading "cannot get clock" output during a normal deferred probe.

clk_prepare_enable() cannot return -EPROBE_DEFER since the clock handle is already acquired at that point, so those error paths are left as dev_err().

Assisted-by Claude:claude-sonnet-4-6

---
Compile tested only. No R-Car hardware available. This is a correctness fix for the deferred probe path, not a response to a reported user visible issue.

Changes in v3:
- Add Assisted-by tag per Documentation/process/coding-assistants.rst

Changes in v2:
- Mention clk_get() explicitly in commit message
- Add testing note under --- cut off line

 drivers/staging/most/dim2/dim2.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/staging/most/dim2/dim2.c +6 -8
index 7953d4626..56f856d6d 100644
@@ -974,10 +974,9 @@ static int rcar_gen2_enable(struct platform_device *pdev)
 	int ret;
 
 	dev->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(dev->clk)) {
-		dev_err(&pdev->dev, "cannot get clock\n");
-		return PTR_ERR(dev->clk);
-	}
+	if (IS_ERR(dev->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(dev->clk),
+				     "cannot get clock\n");
 
 	ret = clk_prepare_enable(dev->clk);
 	if (ret) {
@@ -1019,10 +1018,9 @@ static int rcar_gen3_enable(struct platform_device *pdev)
 	int ret;
 
 	dev->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(dev->clk)) {
-		dev_err(&pdev->dev, "cannot get clock\n");
-		return PTR_ERR(dev->clk);
-	}
+	if (IS_ERR(dev->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(dev->clk),
+				     "cannot get clock\n");
 
 	ret = clk_prepare_enable(dev->clk);
 	if (ret) {
Signature · 1 line
2.53.0