From: Daniel Wagner Date: Fri, 11 Mar 2022 16:46:46 +0000 (+0100) Subject: nvme: constify variable in list_subsys X-Git-Tag: v2.0-rc6 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6d3ca33c721d4481bababdd8280a90b1ea47a1a5;p=users%2Fsagi%2Fnvme-cli.git nvme: constify variable in list_subsys 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 --- diff --git a/nvme.c b/nvme.c index 1ee9a062..7615fb2f 100644 --- 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) {