Received: from eggs.gnu.org ([2001:4830:134:3::10]:33909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnklM-0006rC-E1 for qemu-devel@nongnu.org; Fri, 23 May 2014 04:23:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnklG-0001IT-Fs for qemu-devel@nongnu.org; Fri, 23 May 2014 04:23:36 -0400 Sender: Paolo Bonzini Message-ID: <537F057D.1070503@redhat.com> Date: Fri, 23 May 2014 10:23:25 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1400816645-16005-1-git-send-email-junqing.wang@cs2c.com.cn> In-Reply-To: <1400816645-16005-1-git-send-email-junqing.wang@cs2c.com.cn> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] dma-helpers: avoid calling dma_bdrv_unmap() twice List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jules Wang , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org Il 23/05/2014 05:44, Jules Wang ha scritto: > Calling dma_bdrv_unmap() twice is not necessary and may cause > potential problems if some code changes. > > Signed-off-by: Jules Wang > --- > 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; > Reviewed-by: Paolo Bonzini