Skip to content

Commit 91df775

Browse files
Swati Agarwalvinodkoul
authored andcommitted
dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling
Add missing cleanup in devm_platform_ioremap_resource(). When probe fails remove dma channel resources and disable clocks in accordance with the order of resources allocated . Signed-off-by: Swati Agarwal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 568035b commit 91df775

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/dma/xilinx/xilinx_dma.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3040,9 +3040,10 @@ static int xilinx_dma_probe(struct platform_device *pdev)
30403040

30413041
/* Request and map I/O memory */
30423042
xdev->regs = devm_platform_ioremap_resource(pdev, 0);
3043-
if (IS_ERR(xdev->regs))
3044-
return PTR_ERR(xdev->regs);
3045-
3043+
if (IS_ERR(xdev->regs)) {
3044+
err = PTR_ERR(xdev->regs);
3045+
goto disable_clks;
3046+
}
30463047
/* Retrieve the DMA engine properties from the device tree */
30473048
xdev->max_buffer_len = GENMASK(XILINX_DMA_MAX_TRANS_LEN_MAX - 1, 0);
30483049
xdev->s2mm_chan_id = xdev->dma_config->max_channels / 2;
@@ -3137,7 +3138,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
31373138
for_each_child_of_node(node, child) {
31383139
err = xilinx_dma_child_probe(xdev, child);
31393140
if (err < 0)
3140-
goto disable_clks;
3141+
goto error;
31413142
}
31423143

31433144
if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {
@@ -3172,12 +3173,12 @@ static int xilinx_dma_probe(struct platform_device *pdev)
31723173

31733174
return 0;
31743175

3175-
disable_clks:
3176-
xdma_disable_allclks(xdev);
31773176
error:
31783177
for (i = 0; i < xdev->dma_config->max_channels; i++)
31793178
if (xdev->chan[i])
31803179
xilinx_dma_chan_remove(xdev->chan[i]);
3180+
disable_clks:
3181+
xdma_disable_allclks(xdev);
31813182

31823183
return err;
31833184
}

0 commit comments

Comments
 (0)