[PATCHv2 5/9] dmaengine: mv_xor: use devm_clk_get_optional_enabled

From: Rosen Penev

Date: Thu Jun 11 2026 - 17:10:14 EST


Replace clk_get() + clk_prepare_enable() + clk_put() with
devm_clk_get_optional_enabled(). This eliminates the need for manual clock
cleanup in the probe error path.

Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
drivers/dma/mv_xor.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 44a7d4f7fb0d..d9403172ef59 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1383,12 +1383,9 @@ static int mv_xor_probe(struct platform_device *pdev)
mv_xor_conf_mbus_windows(xordev, dram);
}

- /* Not all platforms can gate the clock, so it is not
- * an error if the clock does not exists.
- */
- xordev->clk = clk_get(&pdev->dev, NULL);
- if (!IS_ERR(xordev->clk))
- clk_prepare_enable(xordev->clk);
+ xordev->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
+ if (IS_ERR(xordev->clk))
+ return PTR_ERR(xordev->clk);

/*
* We don't want to have more than one channel per CPU in
@@ -1477,11 +1474,6 @@ static int mv_xor_probe(struct platform_device *pdev)
irq_dispose_mapping(xordev->channels[i]->irq);
}

- if (!IS_ERR(xordev->clk)) {
- clk_disable_unprepare(xordev->clk);
- clk_put(xordev->clk);
- }
-
return ret;
}

--
2.54.0