Skip to content

Commit

Permalink
dma-helpers: avoid calling dma_bdrv_unmap() twice
Browse files Browse the repository at this point in the history
Calling dma_bdrv_unmap() twice is not necessary and may cause
potential problems if some code changes.

Signed-off-by: Jules Wang <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
  • Loading branch information
Jules Wang authored and Michael Tokarev committed May 23, 2014
1 parent 0971f1b commit 9c132c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dma-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9c132c7

Please sign in to comment.