diff options
author | Klaus Jensen <k.jensen@samsung.com> | 2021-02-02 14:38:57 +0100 |
---|---|---|
committer | Klaus Jensen <k.jensen@samsung.com> | 2021-03-09 11:00:57 +0100 |
commit | ba7b81e769c3d65dc18d1d31b8c9c5b2b0a65cdd (patch) | |
tree | 6cc8e9e42974b852463796a6c02362ef4859e54e /hw/block/nvme.c | |
parent | 67ce28a1fdcf73e2c026dbc43bb8fb6dc9a56aed (diff) |
hw/block/nvme: remove redundant len member in compare context
The 'len' member of the nvme_compare_ctx struct is redundant since the
same information is available in the 'iov' member.
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'hw/block/nvme.c')
-rw-r--r-- | hw/block/nvme.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 30aef5b09e..fcdd6b7cb9 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1703,7 +1703,6 @@ static void nvme_aio_copy_in_cb(void *opaque, int ret) struct nvme_compare_ctx { QEMUIOVector iov; uint8_t *bounce; - size_t len; }; static void nvme_compare_cb(void *opaque, int ret) @@ -1724,16 +1723,16 @@ static void nvme_compare_cb(void *opaque, int ret) goto out; } - buf = g_malloc(ctx->len); + buf = g_malloc(ctx->iov.size); - status = nvme_dma(nvme_ctrl(req), buf, ctx->len, DMA_DIRECTION_TO_DEVICE, - req); + status = nvme_dma(nvme_ctrl(req), buf, ctx->iov.size, + DMA_DIRECTION_TO_DEVICE, req); if (status) { req->status = status; goto out; } - if (memcmp(buf, ctx->bounce, ctx->len)) { + if (memcmp(buf, ctx->bounce, ctx->iov.size)) { req->status = NVME_CMP_FAILURE; } @@ -1974,7 +1973,6 @@ static uint16_t nvme_compare(NvmeCtrl *n, NvmeRequest *req) ctx = g_new(struct nvme_compare_ctx, 1); ctx->bounce = bounce; - ctx->len = len; req->opaque = ctx; |