From: Jules Wang Date: Fri, 23 May 2014 03:44:05 +0000 (+0800) Subject: dma-helpers: avoid calling dma_bdrv_unmap() twice X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9c132c7f64c0605f5c5be79508fa53676be642f9;p=qemu.git 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 Reviewed-by: Paolo Bonzini Signed-off-by: Michael Tokarev --- diff --git a/dma-helpers.c b/dma-helpers.c index 5f421e9814..53cbe925d1 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;