aboutsummaryrefslogtreecommitdiff
path: root/hw/block/nvme.h
diff options
context:
space:
mode:
authorKlaus Jensen <k.jensen@samsung.com>2021-04-14 21:40:40 +0200
committerKlaus Jensen <k.jensen@samsung.com>2021-05-17 09:18:59 +0200
commit72ea5c2c2067086ced90c7f5e4d98c93072a0fc2 (patch)
tree83709f04d57664759c7c2ac96d029cc1b1f88686 /hw/block/nvme.h
parent3ef73f9462a0c142dce80ce5b4ff8789b39f2f64 (diff)
hw/block/nvme: streamline namespace array indexing
Streamline namespace array indexing such that both the subsystem and controller namespaces arrays are 1-indexed. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'hw/block/nvme.h')
-rw-r--r--hw/block/nvme.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/block/nvme.h b/hw/block/nvme.h
index 9349d1c33a..ac3f0a8867 100644
--- a/hw/block/nvme.h
+++ b/hw/block/nvme.h
@@ -438,7 +438,7 @@ typedef struct NvmeCtrl {
NvmeSubsystem *subsys;
NvmeNamespace namespace;
- NvmeNamespace *namespaces[NVME_MAX_NAMESPACES];
+ NvmeNamespace *namespaces[NVME_MAX_NAMESPACES + 1];
NvmeSQueue **sq;
NvmeCQueue **cq;
NvmeSQueue admin_sq;
@@ -460,7 +460,7 @@ static inline NvmeNamespace *nvme_ns(NvmeCtrl *n, uint32_t nsid)
return NULL;
}
- return n->namespaces[nsid - 1];
+ return n->namespaces[nsid];
}
static inline NvmeCQueue *nvme_cq(NvmeRequest *req)