Commit 88e6546b authored by Linus Torvalds's avatar Linus Torvalds

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
parents 06f7db94 e0f1b21c
...@@ -31,14 +31,14 @@ struct udma_dev *of_xudma_dev_get(struct device_node *np, const char *property) ...@@ -31,14 +31,14 @@ struct udma_dev *of_xudma_dev_get(struct device_node *np, const char *property)
} }
pdev = of_find_device_by_node(udma_node); pdev = of_find_device_by_node(udma_node);
if (np != udma_node)
of_node_put(udma_node);
if (!pdev) { if (!pdev) {
pr_debug("UDMA device not found\n"); pr_debug("UDMA device not found\n");
return ERR_PTR(-EPROBE_DEFER); return ERR_PTR(-EPROBE_DEFER);
} }
if (np != udma_node)
of_node_put(udma_node);
ud = platform_get_drvdata(pdev); ud = platform_get_drvdata(pdev);
if (!ud) { if (!ud) {
pr_debug("UDMA has not been probed\n"); pr_debug("UDMA has not been probed\n");
......
...@@ -3040,9 +3040,10 @@ static int xilinx_dma_probe(struct platform_device *pdev) ...@@ -3040,9 +3040,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;
...@@ -3070,7 +3071,7 @@ static int xilinx_dma_probe(struct platform_device *pdev) ...@@ -3070,7 +3071,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
if (err < 0) { if (err < 0) {
dev_err(xdev->dev, dev_err(xdev->dev,
"missing xlnx,num-fstores property\n"); "missing xlnx,num-fstores property\n");
return err; goto disable_clks;
} }
err = of_property_read_u32(node, "xlnx,flush-fsync", err = of_property_read_u32(node, "xlnx,flush-fsync",
...@@ -3090,7 +3091,11 @@ static int xilinx_dma_probe(struct platform_device *pdev) ...@@ -3090,7 +3091,11 @@ static int xilinx_dma_probe(struct platform_device *pdev)
xdev->ext_addr = false; xdev->ext_addr = false;
/* Set the dma mask bits */ /* Set the dma mask bits */
dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); err = dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width));
if (err < 0) {
dev_err(xdev->dev, "DMA mask error %d\n", err);
goto disable_clks;
}
/* Initialize the DMA engine */ /* Initialize the DMA engine */
xdev->common.dev = &pdev->dev; xdev->common.dev = &pdev->dev;
...@@ -3137,7 +3142,7 @@ static int xilinx_dma_probe(struct platform_device *pdev) ...@@ -3137,7 +3142,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) {
...@@ -3172,12 +3177,12 @@ static int xilinx_dma_probe(struct platform_device *pdev) ...@@ -3172,12 +3177,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;
} }
......
...@@ -849,7 +849,7 @@ static struct dma_async_tx_descriptor *zynqmp_dma_prep_memcpy( ...@@ -849,7 +849,7 @@ static struct dma_async_tx_descriptor *zynqmp_dma_prep_memcpy(
zynqmp_dma_desc_config_eod(chan, desc); zynqmp_dma_desc_config_eod(chan, desc);
async_tx_ack(&first->async_tx); async_tx_ack(&first->async_tx);
first->async_tx.flags = flags; first->async_tx.flags = (enum dma_ctrl_flags)flags;
return &first->async_tx; return &first->async_tx;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment