OSDN Git Service

[media] Revert "[media] vb2: Push mmap_sem down to memops"
[uclinux-h8/linux.git] / drivers / media / v4l2-core / videobuf2-vmalloc.c
index 657ab30..2fe4c27 100644 (file)
@@ -287,7 +287,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);
 
@@ -306,8 +305,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);