diff options
author | Klaus Jensen <k.jensen@samsung.com> | 2020-02-23 14:35:20 -0800 |
---|---|---|
committer | Klaus Jensen <k.jensen@samsung.com> | 2020-10-27 07:24:47 +0100 |
commit | 7c9c350c15289b601766c391024e0bfea8a36ee0 (patch) | |
tree | 686de8145db23923e05740f5b3a736ecc3d5ee88 /hw/block | |
parent | d97eee64fef35655bd06f5c44a07fdb83a6274ae (diff) |
hw/block/nvme: refactor identify active namespace id list
Prepare to support inactive namespaces.
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'hw/block')
-rw-r--r-- | hw/block/nvme.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 4f08f55a76..924279d602 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1473,7 +1473,7 @@ static uint16_t nvme_identify_nslist(NvmeCtrl *n, NvmeRequest *req) uint32_t min_nsid = le32_to_cpu(c->nsid); uint32_t *list; uint16_t ret; - int i, j = 0; + int j = 0; trace_pci_nvme_identify_nslist(min_nsid); @@ -1488,11 +1488,11 @@ static uint16_t nvme_identify_nslist(NvmeCtrl *n, NvmeRequest *req) } list = g_malloc0(data_len); - for (i = 0; i < n->num_namespaces; i++) { - if (i < min_nsid) { + for (int i = 1; i <= n->num_namespaces; i++) { + if (i <= min_nsid) { continue; } - list[j++] = cpu_to_le32(i + 1); + list[j++] = cpu_to_le32(i); if (j == data_len / sizeof(uint32_t)) { break; } |