]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: fix status field masking and data type
authorGollu Appalanaidu <anaidu.gollu@samsung.com>
Mon, 22 Feb 2021 19:09:18 +0000 (00:39 +0530)
committerKeith Busch <kbusch@kernel.org>
Mon, 22 Feb 2021 19:19:43 +0000 (12:19 -0700)
Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
nvme.c

diff --git a/nvme.c b/nvme.c
index 42d02413cc4f375373192f582bad6f186bc009e2..b4f40c6bb411f4d4501d58baaa4d5f306f043588 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -2629,9 +2629,9 @@ ret:
        return nvme_status_to_errno(err, false);
 }
 
-static char *nvme_fw_status_reset_type(__u32 status)
+static char *nvme_fw_status_reset_type(__u16 status)
 {
-       switch (status & 0x3ff) {
+       switch (status & 0x7ff) {
        case NVME_SC_FW_NEEDS_CONV_RESET:       return "conventional";
        case NVME_SC_FW_NEEDS_SUBSYS_RESET:     return "subsystem";
        case NVME_SC_FW_NEEDS_RESET:            return "any controller";
@@ -2694,7 +2694,7 @@ static int fw_commit(int argc, char **argv, struct command *cmd, struct plugin *
        if (err < 0)
                perror("fw-commit");
        else if (err != 0)
-               switch (err & 0x3ff) {
+               switch (err & 0x7ff) {
                case NVME_SC_FW_NEEDS_CONV_RESET:
                case NVME_SC_FW_NEEDS_SUBSYS_RESET:
                case NVME_SC_FW_NEEDS_RESET: