Skip to content

Commit

Permalink
nvme: constify variable in list_subsys
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
igaw committed Mar 11, 2022
1 parent c506657 commit 6d3ca33
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6d3ca33

Please sign in to comment.