Skip to content

Commit

Permalink
hw/block/nvme: remove redundant len member in compare context
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
birkelund committed Mar 9, 2021
1 parent 67ce28a commit ba7b81e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions hw/block/nvme.c
Expand Up @@ -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)
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit ba7b81e

Please sign in to comment.