All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: constify fsname parameter of find_mnt_by_fsname()
@ 2018-01-29  7:29 Simon Horman
  0 siblings, 0 replies; only message in thread
From: Simon Horman @ 2018-01-29  7:29 UTC (permalink / raw)
  To: kexec; +Cc: Simon Horman

find_mnt_by_fsname() is called with constant strings as its
fsname parameter and does not modify this parameter, thus
it seems appropriate to make the parameter const.

This problem was brought to my attention by gcc:

$ gcc --version
gcc (Debian 6.3.0-18) 6.3.0 20170516
...

$ make
...
kexec/arch/i386/x86-linux-setup.c: In function ‘get_bootparam’:
kexec/arch/i386/x86-linux-setup.c:447:33: warning: passing argument 1 of ‘find_mnt_by_fsname’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  sysfs_mnt = find_mnt_by_fsname("sysfs");
                                 ^~~~~~~
kexec/arch/i386/x86-linux-setup.c:422:7: note: expected ‘char *’ but argument is of type ‘const char *’
 char *find_mnt_by_fsname(char *fsname)
       ^~~~~~~~~~~~~~~~~~
kexec/arch/i386/x86-linux-setup.c:458:36: warning: passing argument 1 of ‘find_mnt_by_fsname’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   debugfs_mnt = find_mnt_by_fsname("debugfs");
                                    ^~~~~~~~~
kexec/arch/i386/x86-linux-setup.c:422:7: note: expected ‘char *’ but argument is of type ‘const char *’
 char *find_mnt_by_fsname(char *fsname)
...

Signed-off-by: Simon Horman <horms@verge.net.au>
---
 kexec/arch/i386/x86-linux-setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index 2152a2191743..181d7dba2c23 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -419,7 +419,7 @@ out:
  * to be mounted once (sysfs, debugsfs, proc), as it will return the first
  * instance listed in mtab.
  */
-char *find_mnt_by_fsname(char *fsname)
+char *find_mnt_by_fsname(const char *fsname)
 {
 	FILE *mtab;
 	struct mntent *mnt;
-- 
2.11.0


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-29  7:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-29  7:29 [PATCH] x86: constify fsname parameter of find_mnt_by_fsname() Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.