On Wed May 7 18:09:13 2025 +0200, Marek Szyprowski wrote:
> Use common wrappers operating directly on the struct sg_table objects to
> fix incorrect use of scatterlists sync calls. dma_sync_sg_for_*()
> functions have to be called with the number of elements originally passed
> to dma_map_sg_*() function, not the one returned in sgtable's nents.
> 
> Fixes: d33186d0be18 ("[media] omap3isp: ccdc: Use the DMA API for LSC")
> Fixes: 0e24e90f2ca7 ("[media] omap3isp: stat: Use the DMA API")
> CC: sta...@vger.kernel.org
> Signed-off-by: Marek Szyprowski <m.szyprow...@samsung.com>
> Reviewed-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
> Signed-off-by: Hans Verkuil <hverk...@xs4all.nl>

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/platform/ti/omap3isp/ispccdc.c | 8 ++++----
 drivers/media/platform/ti/omap3isp/ispstat.c | 6 ++----
 2 files changed, 6 insertions(+), 8 deletions(-)

---

diff --git a/drivers/media/platform/ti/omap3isp/ispccdc.c 
b/drivers/media/platform/ti/omap3isp/ispccdc.c
index dd375c4e180d..7d0c723dcd11 100644
--- a/drivers/media/platform/ti/omap3isp/ispccdc.c
+++ b/drivers/media/platform/ti/omap3isp/ispccdc.c
@@ -446,8 +446,8 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc,
                if (ret < 0)
                        goto done;
 
-               dma_sync_sg_for_cpu(isp->dev, req->table.sgt.sgl,
-                                   req->table.sgt.nents, DMA_TO_DEVICE);
+               dma_sync_sgtable_for_cpu(isp->dev, &req->table.sgt,
+                                        DMA_TO_DEVICE);
 
                if (copy_from_user(req->table.addr, config->lsc,
                                   req->config.size)) {
@@ -455,8 +455,8 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc,
                        goto done;
                }
 
-               dma_sync_sg_for_device(isp->dev, req->table.sgt.sgl,
-                                      req->table.sgt.nents, DMA_TO_DEVICE);
+               dma_sync_sgtable_for_device(isp->dev, &req->table.sgt,
+                                           DMA_TO_DEVICE);
        }
 
        spin_lock_irqsave(&ccdc->lsc.req_lock, flags);
diff --git a/drivers/media/platform/ti/omap3isp/ispstat.c 
b/drivers/media/platform/ti/omap3isp/ispstat.c
index 359a846205b0..d3da68408ecb 100644
--- a/drivers/media/platform/ti/omap3isp/ispstat.c
+++ b/drivers/media/platform/ti/omap3isp/ispstat.c
@@ -161,8 +161,7 @@ static void isp_stat_buf_sync_for_device(struct ispstat 
*stat,
        if (ISP_STAT_USES_DMAENGINE(stat))
                return;
 
-       dma_sync_sg_for_device(stat->isp->dev, buf->sgt.sgl,
-                              buf->sgt.nents, DMA_FROM_DEVICE);
+       dma_sync_sgtable_for_device(stat->isp->dev, &buf->sgt, DMA_FROM_DEVICE);
 }
 
 static void isp_stat_buf_sync_for_cpu(struct ispstat *stat,
@@ -171,8 +170,7 @@ static void isp_stat_buf_sync_for_cpu(struct ispstat *stat,
        if (ISP_STAT_USES_DMAENGINE(stat))
                return;
 
-       dma_sync_sg_for_cpu(stat->isp->dev, buf->sgt.sgl,
-                           buf->sgt.nents, DMA_FROM_DEVICE);
+       dma_sync_sgtable_for_cpu(stat->isp->dev, &buf->sgt, DMA_FROM_DEVICE);
 }
 
 static void isp_stat_buf_clear(struct ispstat *stat)

Reply via email to