mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
fpga: zynq_fpga: Fix the wrong usage of dma_map_sgtable()
dma_map_sgtable() returns only 0 or the error code. Read sgt->nents to
get the number of mapped segments.
Fixes: 37e0070322
("zynq_fpga: use sgtable-based scatterlist wrappers")
Reported-by: Pavel Pisa <pisa@fel.cvut.cz>
Closes: https://lore.kernel.org/linux-fpga/202508041548.22955.pisa@fel.cvut.cz/
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
Tested-by: Pavel Pisa <pisa@fel.cvut.cz>
Link: https://lore.kernel.org/r/20250806070605.1920909-2-yilun.xu@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c17b750b3a
commit
1ca61060de
1 changed files with 4 additions and 4 deletions
|
@ -405,12 +405,12 @@ static int zynq_fpga_ops_write(struct fpga_manager *mgr, struct sg_table *sgt)
|
|||
}
|
||||
}
|
||||
|
||||
priv->dma_nelms =
|
||||
dma_map_sgtable(mgr->dev.parent, sgt, DMA_TO_DEVICE, 0);
|
||||
if (priv->dma_nelms == 0) {
|
||||
err = dma_map_sgtable(mgr->dev.parent, sgt, DMA_TO_DEVICE, 0);
|
||||
if (err) {
|
||||
dev_err(&mgr->dev, "Unable to DMA map (TO_DEVICE)\n");
|
||||
return -ENOMEM;
|
||||
return err;
|
||||
}
|
||||
priv->dma_nelms = sgt->nents;
|
||||
|
||||
/* enable clock */
|
||||
err = clk_enable(priv->clk);
|
||||
|
|
Loading…
Add table
Reference in a new issue