[PATCH v2 03/13] dmaengine: ste_dma40: Init hardware before registration

Linus Walleij <[email protected]>
Newsgroups org.kernel.vger.phone-devel,org.kernel.vger.dmaengine
Message-ID <[email protected]>
d40_probe() registers DMAengine devices before calling d40_hw_init(). Once
the DMAengine devices are registered, channels can be requested and a
client can issue transfers before the DMA40 hardware has been initialized.

Initialize the hardware and set the DMA segment limit before registering
the DMAengine devices, so no globally visible channel can start from the
uninitialized hardware state.

Reported-by: [email protected]
Closes: https://lore.kernel.org/dmaengine/[email protected]/
Assisted-by: Codex:gpt-5-5
Signed-off-by: Linus Walleij <[email protected]>
---
 drivers/dma/ste_dma40.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index dd449d4285ef..145f7105218c 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -3634,14 +3634,14 @@ static int __init d40_probe(struct platform_device *pdev)
 	pm_runtime_set_active(base->dev);
 	pm_runtime_enable(base->dev);
 
-	ret = d40_dmaengine_init(base, num_reserved_chans);
-	if (ret)
-		goto destroy_cache;
-
 	dma_set_max_seg_size(base->dev, STEDMA40_MAX_SEG_SIZE);
 
 	d40_hw_init(base);
 
+	ret = d40_dmaengine_init(base, num_reserved_chans);
+	if (ret)
+		goto destroy_cache;
+
 	ret = of_dma_controller_register(np, d40_xlate, NULL);
 	if (ret) {
 		dev_err(dev,

-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.