mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-30 08:04:13 +08:00
[media] media/videobuf2-dma-vmalloc: 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: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
60a4719238
commit
ba81c6ed3d
@ -291,7 +291,6 @@ static struct sg_table *vb2_vmalloc_dmabuf_ops_map(
|
||||
/* stealing dmabuf mutex to serialize map/unmap operations */
|
||||
struct mutex *lock = &db_attach->dmabuf->lock;
|
||||
struct sg_table *sgt;
|
||||
int ret;
|
||||
|
||||
mutex_lock(lock);
|
||||
|
||||
@ -310,8 +309,9 @@ static struct sg_table *vb2_vmalloc_dmabuf_ops_map(
|
||||
}
|
||||
|
||||
/* mapping to the client with new direction */
|
||||
ret = dma_map_sg(db_attach->dev, sgt->sgl, sgt->orig_nents, dma_dir);
|
||||
if (ret <= 0) {
|
||||
sgt->nents = dma_map_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
|
||||
dma_dir);
|
||||
if (!sgt->nents) {
|
||||
pr_err("failed to map scatterlist\n");
|
||||
mutex_unlock(lock);
|
||||
return ERR_PTR(-EIO);
|
||||
|
Loading…
Reference in New Issue
Block a user