]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
dma: the passed io_func does not return NULL
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 14 Nov 2011 16:50:52 +0000 (17:50 +0100)
committerKevin Wolf <kwolf@redhat.com>
Thu, 15 Dec 2011 11:40:08 +0000 (12:40 +0100)
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 <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
dma-helpers.c

index 9d6b6fa1fdfd4265e7141c7c09c6835905380d92..f08cdb5454427cd796cef6b9024722cd01963bcf 100644 (file)
@@ -142,9 +142,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)