From a70174ef2e6cd73b8e071ed7ce3cbef8ccb60089 Mon Sep 17 00:00:00 2001 From: Klaus Jensen Date: Mon, 6 Jul 2020 08:12:47 +0200 Subject: hw/block/nvme: fix missing endian conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a missing cpu_to conversion by moving conversion to just before returning instead. Signed-off-by: Klaus Jensen Suggested-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Dmitry Fomichev Reviewed-by: Maxim Levitsky Message-Id: <20200706061303.246057-3-its@irrelevant.dk> --- hw/block/nvme.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hw/block') diff --git a/hw/block/nvme.c b/hw/block/nvme.c index abd901fe1e..43b70730e4 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -814,8 +814,8 @@ static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req) trace_pci_nvme_getfeat_vwcache(result ? "enabled" : "disabled"); break; case NVME_NUMBER_OF_QUEUES: - result = cpu_to_le32((n->params.max_ioqpairs - 1) | - ((n->params.max_ioqpairs - 1) << 16)); + result = (n->params.max_ioqpairs - 1) | + ((n->params.max_ioqpairs - 1) << 16); trace_pci_nvme_getfeat_numq(result); break; case NVME_TIMESTAMP: @@ -825,7 +825,7 @@ static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req) return NVME_INVALID_FIELD | NVME_DNR; } - req->cqe.result = result; + req->cqe.result = cpu_to_le32(result); return NVME_SUCCESS; } -- cgit v1.2.3