Commit 60a47192 authored by Ricardo Ribalda's avatar Ricardo Ribalda Committed by Mauro Carvalho Chehab

[media] media/videobuf2-dma-contig: Save output from dma_map_sg

dma_map_sg returns the number of areas mapped by the hardware,
which could be different than the areas given as an input.
The output must be saved to nent.
Signed-off-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Reviewed-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 6a5d77cb
...@@ -299,7 +299,6 @@ static struct sg_table *vb2_dc_dmabuf_ops_map( ...@@ -299,7 +299,6 @@ static struct sg_table *vb2_dc_dmabuf_ops_map(
/* stealing dmabuf mutex to serialize map/unmap operations */ /* stealing dmabuf mutex to serialize map/unmap operations */
struct mutex *lock = &db_attach->dmabuf->lock; struct mutex *lock = &db_attach->dmabuf->lock;
struct sg_table *sgt; struct sg_table *sgt;
int ret;
mutex_lock(lock); mutex_lock(lock);
...@@ -318,8 +317,9 @@ static struct sg_table *vb2_dc_dmabuf_ops_map( ...@@ -318,8 +317,9 @@ static struct sg_table *vb2_dc_dmabuf_ops_map(
} }
/* mapping to the client with new direction */ /* mapping to the client with new direction */
ret = dma_map_sg(db_attach->dev, sgt->sgl, sgt->orig_nents, dma_dir); sgt->nents = dma_map_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
if (ret <= 0) { dma_dir);
if (!sgt->nents) {
pr_err("failed to map scatterlist\n"); pr_err("failed to map scatterlist\n");
mutex_unlock(lock); mutex_unlock(lock);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
......
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