Skip to content

Commit

Permalink
hw/nvme: Clean up local variable shadowing in nvme_ns_init()
Browse files Browse the repository at this point in the history
Fix local variable shadowing in nvme_ns_init().

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Message-ID: <20230925-fix-local-shadowing-v1-1-3a1172132377@samsung.com>
Reviewed-by: Jesper Wendel Devantier <j.devantier@samsung.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
  • Loading branch information
birkelund authored and Markus Armbruster committed Sep 29, 2023
1 parent 5567fa8 commit f193d0b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hw/nvme/ns.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static int nvme_ns_init(NvmeNamespace *ns, Error **errp)

ns->pif = ns->params.pif;

static const NvmeLBAF lbaf[16] = {
static const NvmeLBAF defaults[16] = {
[0] = { .ds = 9 },
[1] = { .ds = 9, .ms = 8 },
[2] = { .ds = 9, .ms = 16 },
Expand All @@ -120,7 +120,7 @@ static int nvme_ns_init(NvmeNamespace *ns, Error **errp)

ns->nlbaf = 8;

memcpy(&id_ns->lbaf, &lbaf, sizeof(lbaf));
memcpy(&id_ns->lbaf, &defaults, sizeof(defaults));

for (i = 0; i < ns->nlbaf; i++) {
NvmeLBAF *lbaf = &id_ns->lbaf[i];
Expand Down

0 comments on commit f193d0b

Please sign in to comment.