nvme: fix nvme_pr_* status code parsing
PATCH v2 1/1 nvme: fix nvme_pr_* status code parsing
Fix the parsing if extra status bits (e.g. MORE) is present.
---
previous version of this is sent as
https://lore.kernel.org/linux-nvme/[email protected]/
drivers/nvme/host/pr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/pr.c +1 -1
@@ -77,7 +77,7 @@ static int nvme_sc_to_pr_err(int nvme_sc)if (nvme_is_path_error (nvme_sc))return PR_STS_PATH_FAILED ; -switch (nvme_sc) { +switch (nvme_sc &0x7ff ) {case NVME_SC_SUCCESS :return PR_STS_SUCCESS ;case NVME_SC_RESERVATION_CONFLICT :
Signature · 1 line
2.45.1
Christoph Hellwig
maintainerdrivers/nvme/host/pr.c static int nvme_sc_to_pr_err(int nvme_sc) · line 80
Quoted 1 line · Weiwen Hu
drivers/nvme/host/pr.c +1
-0+switch (nvme_sc &0x7ff ) {
Can you use the opportunity to add a NVME_SC_MASK symbolic name for the magic 0x7ff? We should have done this earlier with already 5 occurrences, but better now than never.
Otherwise this looks good to me.
Quoted 6 lines · Christoph Hellwig
drivers/nvme/host/pr.c static int nvme_sc_to_pr_err(int nvme_sc) · line 80
Quoted 1 line · Weiwen Hu
drivers/nvme/host/pr.c +1
-0+switch (nvme_sc &0x7ff ) {Can you use the opportunity to add a
NVME_SC_MASKsymbolic name for the magic0x7ff? We should have done this earlier with already 5 occurrences, but better now than never.
I've already sent this in the previous patch:
[PATCH 2/3] nvme: fix status magic numbers
I chose the name NVME_SCT_SC_MASK to match the NVMe spec better
Keith Busch
maintainerQuoted 8 lines · Christoph Hellwig
drivers/nvme/host/pr.c static int nvme_sc_to_pr_err(int nvme_sc) · line 80
Quoted 1 line · Weiwen Hu
drivers/nvme/host/pr.c +1
-0+switch (nvme_sc &0x7ff ) {Can you use the opportunity to add a
NVME_SC_MASKsymbolic name for the magic0x7ff? We should have done this earlier with already 5 occurrences, but better now than never.Otherwise this looks good to me.
Yeah, I suggested sending the minimal patch first just for the backport-ability.
Quoted 4 lines · Weiwen Hu
Fix the parsing if extra status bits (e.g. MORE) is present.
Fixes 7fb42780d06c ("nvme: Convert NVMe errors to PR errors")Signed-off-by Weiwen Hu <[email protected]>
Thanks, applied to nvme-6.10.