]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
Allow for firmware activation that needs a reset
authorPaul Grabinar <pgrabinar@ocztechnology.com>
Mon, 10 Aug 2015 12:28:03 +0000 (13:28 +0100)
committerPaul Grabinar <pgrabinar@ocztechnology.com>
Mon, 10 Aug 2015 12:28:03 +0000 (13:28 +0100)
On a firmware activate, some drives require a reset before the new
firmware can be used. Such drives return a status 0x10b to the activate
request.
Rather than treat this as an error, tell this user the activation was
successful, but a reset is required.

nvme.c

diff --git a/nvme.c b/nvme.c
index a59d3ca2baae573b5a515469244284ee7e93a339..3fd95e661b10dda501602e782555d002da550003 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -2172,8 +2172,12 @@ static int fw_activate(int argc, char **argv)
        if (err < 0)
                perror("ioctl");
        else if (err != 0)
-               fprintf(stderr, "NVME Admin command error:%s(%x)\n",
-                                       nvme_status_to_string(err), err);
+               if (err == NVME_SC_FIRMWARE_NEEDS_RESET)
+                       printf("Success activating firmware action:%d slot:%d, but a conventional reset is required\n",
+                              cfg.action, cfg.slot);
+               else
+                       fprintf(stderr, "NVME Admin command error:%s(%x)\n",
+                                               nvme_status_to_string(err), err);
        else
                printf("Success activating firmware action:%d slot:%d\n",
                       cfg.action, cfg.slot);