[PATCH] nvme:core: initialize core quirks before calling nvme_init_subsystem()

Pankaj Raghav p.raghav at samsung.com
Thu Dec 1 04:52:34 PST 2022


A device might have a core quirk for NVME_QUIRK_IGNORE_DEV_SUBNQN(such as
Samsung X5) but it would still give a warning "missing or invalid
SUBNQN field" as core quirks are filled after calling nvme_init_subnqn().

Fill ctrl->quirks from struct core_quirks before calling
nvme_init_subsystem().

Tested it on a Samsung X5:

Before patch:
nvme nvme1: pci function 0000:3e:00.0
nvme 0000:3e:00.0: enabling device (0000 -> 0002)
nvme nvme1: missing or invalid SUBNQN field.
nvme nvme1: Shutdown timeout set to 8 seconds
nvme nvme1: 8/0/0 default/read/poll queues

After Patch:
nvme nvme1: pci function 0000:3e:00.0
nvme 0000:3e:00.0: enabling device (0000 -> 0002)
nvme nvme1: Shutdown timeout set to 8 seconds
nvme nvme1: 8/0/0 default/read/poll queues

Fixes: ab9e00cc72fa ("nvme: track subsystems")
Signed-off-by: Pankaj Raghav <p.raghav at samsung.com>
---
 drivers/nvme/host/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e68b98daf38a..0ac37a4afc20 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3123,10 +3123,6 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
 	if (!ctrl->identified) {
 		unsigned int i;
 
-		ret = nvme_init_subsystem(ctrl, id);
-		if (ret)
-			goto out_free;
-
 		/*
 		 * Check for quirks.  Quirk can depend on firmware version,
 		 * so, in principle, the set of quirks present can change
@@ -3139,6 +3135,10 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
 			if (quirk_matches(id, &core_quirks[i]))
 				ctrl->quirks |= core_quirks[i].quirks;
 		}
+
+		ret = nvme_init_subsystem(ctrl, id);
+		if (ret)
+			goto out_free;
 	}
 	memcpy(ctrl->subsys->firmware_rev, id->fr,
 	       sizeof(ctrl->subsys->firmware_rev));
-- 
2.35.1




More information about the Linux-nvme mailing list