]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: constify variable in list_subsys v2.0-rc6
authorDaniel Wagner <dwagner@suse.de>
Fri, 11 Mar 2022 16:46:46 +0000 (17:46 +0100)
committerDaniel Wagner <dwagner@suse.de>
Fri, 11 Mar 2022 16:46:46 +0000 (17:46 +0100)
The compiler complains with

../nvme.c: In function ‘list_subsys’:
../nvme.c:2478:19: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 2478 |                 n = strrchr(devicename, 'n');
      |                   ^

devicename is of type 'const char *' so the returning pointer is of
the same type. Thus constify the n variable.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
nvme.c

diff --git a/nvme.c b/nvme.c
index 1ee9a062da98bf19b3e6993e1292a9bc42c5e84d..7615fb2ff42fc15d24f85bcc40e4a511427fb485 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -2473,7 +2473,8 @@ static int list_subsys(int argc, char **argv, struct command *cmd,
        }
 
        if (devicename) {
-               char *n, *eptr = NULL;
+               const char *n;
+               char *eptr = NULL;
 
                n = strrchr(devicename, 'n');
                if (!n) {