]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
dmaengine: axi-dmac: fix possible race in remove()
authorNuno Sa <nuno.sa@analog.com>
Thu, 28 Mar 2024 13:58:50 +0000 (14:58 +0100)
committerVinod Koul <vkoul@kernel.org>
Sun, 7 Apr 2024 11:40:20 +0000 (17:10 +0530)
We need to first free the IRQ before calling of_dma_controller_free().
Otherwise we could get an interrupt and schedule a tasklet while
removing the DMA controller.

Fixes: 0e3b67b348b8 ("dmaengine: Add support for the Analog Devices AXI-DMAC DMA controller")
Cc: stable@kernel.org
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240328-axi-dmac-devm-probe-v3-1-523c0176df70@analog.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/dma-axi-dmac.c

index 4e339c04fc1ea1e973a385250a144945984ae1fd..d5a33e4a91b19a859e1ea72a22459cd8aba229ef 100644 (file)
@@ -1134,8 +1134,8 @@ static void axi_dmac_remove(struct platform_device *pdev)
 {
        struct axi_dmac *dmac = platform_get_drvdata(pdev);
 
-       of_dma_controller_free(pdev->dev.of_node);
        free_irq(dmac->irq, dmac);
+       of_dma_controller_free(pdev->dev.of_node);
        tasklet_kill(&dmac->chan.vchan.task);
        dma_async_device_unregister(&dmac->dma_dev);
        clk_disable_unprepare(dmac->clk);