Skip to content

Commit 88e6546

Browse files
committed
Merge tag 'dmaengine-fix-6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine
Pull dmaengine fixes from Vinod Koul: "A couple of small driver fixes: - xilinx_dma: devm_platform_ioremap_resource error handling, dma_set_mask_and_coherent failure handling, dt property read cleanup - refcount leak fix for of_xudma_dev_get() - zynqmp_dma: coverity fix for enum typecast" * tag 'dmaengine-fix-6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine: dmaengine: zynqmp_dma: Typecast with enum to fix the coverity warning dmaengine: ti: k3-udma-private: Fix refcount leak bug in of_xudma_dev_get() dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property dmaengine: xilinx_dma: Fix devm_platform_ioremap_resource error handling
2 parents 06f7db9 + e0f1b21 commit 88e6546

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

drivers/dma/ti/k3-udma-private.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ struct udma_dev *of_xudma_dev_get(struct device_node *np, const char *property)
3131
}
3232

3333
pdev = of_find_device_by_node(udma_node);
34+
if (np != udma_node)
35+
of_node_put(udma_node);
36+
3437
if (!pdev) {
3538
pr_debug("UDMA device not found\n");
3639
return ERR_PTR(-EPROBE_DEFER);
3740
}
3841

39-
if (np != udma_node)
40-
of_node_put(udma_node);
41-
4242
ud = platform_get_drvdata(pdev);
4343
if (!ud) {
4444
pr_debug("UDMA has not been probed\n");

drivers/dma/xilinx/xilinx_dma.c

Lines changed: 13 additions & 8 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;
@@ -3070,7 +3071,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
30703071
if (err < 0) {
30713072
dev_err(xdev->dev,
30723073
"missing xlnx,num-fstores property\n");
3073-
return err;
3074+
goto disable_clks;
30743075
}
30753076

30763077
err = of_property_read_u32(node, "xlnx,flush-fsync",
@@ -3090,7 +3091,11 @@ static int xilinx_dma_probe(struct platform_device *pdev)
30903091
xdev->ext_addr = false;
30913092

30923093
/* Set the dma mask bits */
3093-
dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width));
3094+
err = dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width));
3095+
if (err < 0) {
3096+
dev_err(xdev->dev, "DMA mask error %d\n", err);
3097+
goto disable_clks;
3098+
}
30943099

30953100
/* Initialize the DMA engine */
30963101
xdev->common.dev = &pdev->dev;
@@ -3137,7 +3142,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
31373142
for_each_child_of_node(node, child) {
31383143
err = xilinx_dma_child_probe(xdev, child);
31393144
if (err < 0)
3140-
goto disable_clks;
3145+
goto error;
31413146
}
31423147

31433148
if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {
@@ -3172,12 +3177,12 @@ static int xilinx_dma_probe(struct platform_device *pdev)
31723177

31733178
return 0;
31743179

3175-
disable_clks:
3176-
xdma_disable_allclks(xdev);
31773180
error:
31783181
for (i = 0; i < xdev->dma_config->max_channels; i++)
31793182
if (xdev->chan[i])
31803183
xilinx_dma_chan_remove(xdev->chan[i]);
3184+
disable_clks:
3185+
xdma_disable_allclks(xdev);
31813186

31823187
return err;
31833188
}

drivers/dma/xilinx/zynqmp_dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ static struct dma_async_tx_descriptor *zynqmp_dma_prep_memcpy(
849849

850850
zynqmp_dma_desc_config_eod(chan, desc);
851851
async_tx_ack(&first->async_tx);
852-
first->async_tx.flags = flags;
852+
first->async_tx.flags = (enum dma_ctrl_flags)flags;
853853
return &first->async_tx;
854854
}
855855

0 commit comments

Comments
 (0)