From: Jeff Lien Date: Tue, 12 Sep 2017 17:37:05 +0000 (-0500) Subject: NVMe-CLI Fixed Status Code check for reset type on fw-activate. X-Git-Tag: v1.4~4 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6acdd9bdae95eee436639476edd80022d999147e;p=users%2Fsagi%2Fnvme-cli.git NVMe-CLI Fixed Status Code check for reset type on fw-activate. If a device returns a fw-activate status with the More or DNR bit set, the CLI code will return a message indicating an Admin command error instead of succesful status. With this patch, the More and DNR bits will be masked off and not affect the returned message. Signed-off-by: Keith Busch --- diff --git a/nvme.c b/nvme.c index f1d6d65c..d495cbba 100644 --- a/nvme.c +++ b/nvme.c @@ -1389,7 +1389,7 @@ static int fw_download(int argc, char **argv, struct command *cmd, struct plugin static char *nvme_fw_status_reset_type(__u32 status) { - switch (status) { + switch (status & 0x3ff) { 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"; @@ -1441,7 +1441,7 @@ static int fw_activate(int argc, char **argv, struct command *cmd, struct plugin if (err < 0) perror("fw-activate"); else if (err != 0) - switch (err) { + switch (err & 0x3ff) { case NVME_SC_FW_NEEDS_CONV_RESET: case NVME_SC_FW_NEEDS_SUBSYS_RESET: case NVME_SC_FW_NEEDS_RESET: