diff options
author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2021-10-06 18:49:29 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2021-11-02 15:49:13 +0100 |
commit | a8951438946d72d74c9bdbdb38fce95aa2973a88 (patch) | |
tree | c1177eed73cfbec2ba5b681b4354549c82bc5d96 | |
parent | 53cedeaaee9d585bd07eb921fa5557c64531f69b (diff) |
block/nvme: Extract nvme_free_queue() from nvme_free_queue_pair()
Instead of duplicating code, extract the common helper to free
a single queue.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20211006164931.172349-4-philmd@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r-- | block/nvme.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/block/nvme.c b/block/nvme.c index 0c94799a54..e4f336d79c 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -183,15 +183,20 @@ static bool nvme_init_queue(BDRVNVMeState *s, NVMeQueue *q, return r == 0; } +static void nvme_free_queue(NVMeQueue *q) +{ + qemu_vfree(q->queue); +} + static void nvme_free_queue_pair(NVMeQueuePair *q) { trace_nvme_free_queue_pair(q->index, q, &q->cq, &q->sq); if (q->completion_bh) { qemu_bh_delete(q->completion_bh); } + nvme_free_queue(&q->sq); + nvme_free_queue(&q->cq); qemu_vfree(q->prp_list_pages); - qemu_vfree(q->sq.queue); - qemu_vfree(q->cq.queue); qemu_mutex_destroy(&q->lock); g_free(q); } |