]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nvme initialize core quirks before calling nvme_init_subsystem
authorPankaj Raghav <p.raghav@samsung.com>
Thu, 1 Dec 2022 12:52:34 +0000 (13:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Dec 2022 10:32:03 +0000 (11:32 +0100)
[ Upstream commit 6f2d71524bcfdeb1fcbd22a4a92a5b7b161ab224 ]

A device might have a core quirk for NVME_QUIRK_IGNORE_DEV_SUBNQN
(such as Samsung X5) but it would still give a:

    "missing or invalid SUBNQN field"

warning as core quirks are filled after calling nvme_init_subnqn.  Fill
ctrl->quirks from struct core_quirks before calling nvme_init_subsystem
to fix this.

Tested on a Samsung X5.

Fixes: ab9e00cc72fa ("nvme: track subsystems")
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c

index d9c78fe85cb38d942bf10d4cc654a92d1264c02c..e162f1dfbafe9e4cba173096b1035e9285ced2a3 100644 (file)
@@ -3092,10 +3092,6 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
        if (!ctrl->identified) {
                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
@@ -3108,6 +3104,10 @@ 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));