From: Jules Wang <junqing.wang@cs2c.com.cn>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, pbonzini@redhat.com,
Jules Wang <junqing.wang@cs2c.com.cn>
Subject: [Qemu-devel] [PATCH] dma-helpers: avoid calling dma_bdrv_unmap() twice
Date: Fri, 23 May 2014 11:44:05 +0800 [thread overview]
Message-ID: <1400816645-16005-1-git-send-email-junqing.wang@cs2c.com.cn> (raw)
Calling dma_bdrv_unmap() twice is not necessary and may cause
potential problems if some code changes.
Signed-off-by: Jules Wang <junqing.wang@cs2c.com.cn>
---
dma-helpers.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dma-helpers.c b/dma-helpers.c
index 5f421e9..53cbe92 100644
--- a/dma-helpers.c
+++ b/dma-helpers.c
@@ -143,12 +143,12 @@ static void dma_bdrv_cb(void *opaque, int ret)
dbs->acb = NULL;
dbs->sector_num += dbs->iov.size / 512;
- dma_bdrv_unmap(dbs);
if (dbs->sg_cur_index == dbs->sg->nsg || ret < 0) {
dma_complete(dbs, ret);
return;
}
+ dma_bdrv_unmap(dbs);
while (dbs->sg_cur_index < dbs->sg->nsg) {
cur_addr = dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byte;
--
1.7.1
next reply other threads:[~2014-05-23 4:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-23 3:44 Jules Wang [this message]
2014-05-23 8:23 ` [Qemu-devel] [PATCH] dma-helpers: avoid calling dma_bdrv_unmap() twice Paolo Bonzini
2014-05-23 20:32 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
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=1400816645-16005-1-git-send-email-junqing.wang@cs2c.com.cn \
--to=junqing.wang@cs2c.com.cn \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).