hw/block/nvme: Verify msix_vector_use() returned value

msix_vector_use() returns -EINVAL on error. Assert it won't.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200609190333.59390-21-its@irrelevant.dk>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Philippe Mathieu-Daudé 2020-06-09 21:03:31 +02:00 committed by Kevin Wolf
parent 945cb8f4c2
commit fbf2e5375e

View File

@ -615,6 +615,10 @@ static uint16_t nvme_del_cq(NvmeCtrl *n, NvmeCmd *cmd)
static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n, uint64_t dma_addr, static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n, uint64_t dma_addr,
uint16_t cqid, uint16_t vector, uint16_t size, uint16_t irq_enabled) uint16_t cqid, uint16_t vector, uint16_t size, uint16_t irq_enabled)
{ {
int ret;
ret = msix_vector_use(&n->parent_obj, vector);
assert(ret == 0);
cq->ctrl = n; cq->ctrl = n;
cq->cqid = cqid; cq->cqid = cqid;
cq->size = size; cq->size = size;
@ -625,7 +629,6 @@ static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n, uint64_t dma_addr,
cq->head = cq->tail = 0; cq->head = cq->tail = 0;
QTAILQ_INIT(&cq->req_list); QTAILQ_INIT(&cq->req_list);
QTAILQ_INIT(&cq->sq_list); QTAILQ_INIT(&cq->sq_list);
msix_vector_use(&n->parent_obj, cq->vector);
n->cq[cqid] = cq; n->cq[cqid] = cq;
cq->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, nvme_post_cqes, cq); cq->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, nvme_post_cqes, cq);
} }