提交 554f1e66 编写于 作者: S Swati Agarwal 提交者: Jialin Zhang

dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling

stable inclusion
from stable-v5.10.148
commit 789e590cb8c4021de0c1ec0fcdae7e4615e4f3e7
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6D0WL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=789e590cb8c4021de0c1ec0fcdae7e4615e4f3e7

--------------------------------

[ Upstream commit 91df7751 ]

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: NSwati Agarwal <swati.agarwal@xilinx.com>
Link: https://lore.kernel.org/r/20220817061125.4720-2-swati.agarwal@xilinx.comSigned-off-by: NVinod Koul <vkoul@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NJialin Zhang <zhangjialin11@huawei.com>
Reviewed-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 c3ee1e05
...@@ -3020,9 +3020,10 @@ static int xilinx_dma_probe(struct platform_device *pdev) ...@@ -3020,9 +3020,10 @@ static int xilinx_dma_probe(struct platform_device *pdev)
/* Request and map I/O memory */ /* Request and map I/O memory */
xdev->regs = devm_platform_ioremap_resource(pdev, 0); xdev->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(xdev->regs)) if (IS_ERR(xdev->regs)) {
return PTR_ERR(xdev->regs); err = PTR_ERR(xdev->regs);
goto disable_clks;
}
/* Retrieve the DMA engine properties from the device tree */ /* Retrieve the DMA engine properties from the device tree */
xdev->max_buffer_len = GENMASK(XILINX_DMA_MAX_TRANS_LEN_MAX - 1, 0); xdev->max_buffer_len = GENMASK(XILINX_DMA_MAX_TRANS_LEN_MAX - 1, 0);
xdev->s2mm_chan_id = xdev->dma_config->max_channels / 2; xdev->s2mm_chan_id = xdev->dma_config->max_channels / 2;
...@@ -3115,7 +3116,7 @@ static int xilinx_dma_probe(struct platform_device *pdev) ...@@ -3115,7 +3116,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
for_each_child_of_node(node, child) { for_each_child_of_node(node, child) {
err = xilinx_dma_child_probe(xdev, child); err = xilinx_dma_child_probe(xdev, child);
if (err < 0) if (err < 0)
goto disable_clks; goto error;
} }
if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {
...@@ -3150,12 +3151,12 @@ static int xilinx_dma_probe(struct platform_device *pdev) ...@@ -3150,12 +3151,12 @@ static int xilinx_dma_probe(struct platform_device *pdev)
return 0; return 0;
disable_clks:
xdma_disable_allclks(xdev);
error: error:
for (i = 0; i < xdev->dma_config->max_channels; i++) for (i = 0; i < xdev->dma_config->max_channels; i++)
if (xdev->chan[i]) if (xdev->chan[i])
xilinx_dma_chan_remove(xdev->chan[i]); xilinx_dma_chan_remove(xdev->chan[i]);
disable_clks:
xdma_disable_allclks(xdev);
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册