From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:32811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPzkb-0004fY-A2 for qemu-devel@nongnu.org; Mon, 14 Nov 2011 11:51:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RPzka-0000wY-0T for qemu-devel@nongnu.org; Mon, 14 Nov 2011 11:51:17 -0500 Received: from mail-gy0-f173.google.com ([209.85.160.173]:33241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPzkZ-0000wT-Sp for qemu-devel@nongnu.org; Mon, 14 Nov 2011 11:51:15 -0500 Received: by gyb11 with SMTP id 11so5833400gyb.4 for ; Mon, 14 Nov 2011 08:51:15 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 14 Nov 2011 17:50:52 +0100 Message-Id: <1321289454-9219-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1321289454-9219-1-git-send-email-pbonzini@redhat.com> References: <1321289454-9219-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 1.1 4/6] dma: the passed io_func does not return NULL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Initially found with the following semantic patch: @ type @ BlockDriverAIOCB *x; expression E; @@ x = E; - if (x == NULL) { ... } @ acb1 @ expression E, E1; @@ E1->acb = E; - if (E1->acb == NULL) { ... } @ aiocb1 @ expression E, E1; @@ E1->aiocb = E; - if (E1->aiocb == NULL) { ... } @ acb @ expression E, E1; @@ E1.acb = E; - if (E1.acb == NULL) { ... } @ aiocb @ expression E, E1; @@ E1.aiocb = E; - if (E1.aiocb == NULL) { ... } but changed manually to include an assert. Signed-off-by: Paolo Bonzini --- dma-helpers.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/dma-helpers.c b/dma-helpers.c index bdcd38c..a79a2f9 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -136,9 +136,7 @@ static void dma_bdrv_cb(void *opaque, int ret) dbs->acb = dbs->io_func(dbs->bs, dbs->sector_num, &dbs->iov, dbs->iov.size / 512, dma_bdrv_cb, dbs); - if (!dbs->acb) { - dma_complete(dbs, -EIO); - } + assert(dbs->acb); } static void dma_aio_cancel(BlockDriverAIOCB *acb) -- 1.7.7.1