From: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
To: Hans Verkuil <hans.verkuil@cisco.com>,
Pawel Osciak <pawel@osciak.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Ricardo Ribalda <ricardo.ribalda@gmail.com>
Subject: [RESEND PATCH v2 3/3] media/videobuf2-dma-vmalloc: Save output from dma_map_sg
Date: Wed, 29 Apr 2015 14:00:47 +0200 [thread overview]
Message-ID: <1430308847-32140-4-git-send-email-ricardo.ribalda@gmail.com> (raw)
In-Reply-To: <1430308847-32140-1-git-send-email-ricardo.ribalda@gmail.com>
From: Ricardo Ribalda <ricardo.ribalda@gmail.com>
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>
---
drivers/media/v4l2-core/videobuf2-vmalloc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c b/drivers/media/v4l2-core/videobuf2-vmalloc.c
index 657ab302a5cf..2fe4c27f524a 100644
--- a/drivers/media/v4l2-core/videobuf2-vmalloc.c
+++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c
@@ -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);
--
2.1.4
prev parent reply other threads:[~2015-04-29 12:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 12:00 [RESEND PATCH v2 0/3] Fix handling of sg_table struct Ricardo Ribalda Delgado
2015-04-29 12:00 ` [RESEND PATCH v2 1/3] media/videobuf2-dma-sg: Fix handling of sg_table structure Ricardo Ribalda Delgado
2015-04-29 12:00 ` [RESEND PATCH v2 2/3] media/videobuf2-dma-contig: Save output from dma_map_sg Ricardo Ribalda Delgado
2015-04-29 12:00 ` Ricardo Ribalda Delgado [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430308847-32140-4-git-send-email-ricardo.ribalda@gmail.com \
--to=ricardo.ribalda@gmail.com \
--cc=hans.verkuil@cisco.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mchehab@osg.samsung.com \
--cc=pawel@osciak.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®