aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Wang <junqing.wang@cs2c.com.cn>2014-05-23 11:44:05 +0800
committerMichael Tokarev <mjt@tls.msk.ru>2014-05-24 00:28:43 +0400
commit9c132c7f64c0605f5c5be79508fa53676be642f9 (patch)
treeb56a3a5df109d3952b7a4c7feb95627e39a6718a
parent0971f1bed21b16e59eb5d15cd03180f110a1e8c0 (diff)
downloadqemu-9c132c7f64c0605f5c5be79508fa53676be642f9.zip
qemu-9c132c7f64c0605f5c5be79508fa53676be642f9.tar.gz
qemu-9c132c7f64c0605f5c5be79508fa53676be642f9.tar.bz2
dma-helpers: avoid calling dma_bdrv_unmap() twice
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> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--dma-helpers.c2
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;