[PATCH] fs: mark string returned by get_mounted_path as const

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Apr 2 01:13:18 PDT 2025


The string returned is not freshly allocated and modifying it is a bad
idea, so mark it const.

This breaks no in-tree users.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 fs/fs.c      | 2 +-
 include/fs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 4e23aef79771..f73128ae2067 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -305,7 +305,7 @@ struct cdev *get_cdev_by_mountpath(const char *path)
 	return fsdev->cdev;
 }
 
-char *get_mounted_path(const char *path)
+const char *get_mounted_path(const char *path)
 {
 	struct fs_device *fdev;
 
diff --git a/include/fs.h b/include/fs.h
index bf927da4207e..e72f9bac174c 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -155,7 +155,7 @@ char *canonicalize_path(int dirfd, const char *pathname);
 
 struct fs_device *get_fsdevice_by_path(int dirfd, const char *path);
 
-char *get_mounted_path(const char *path);
+const char *get_mounted_path(const char *path);
 
 struct cdev *get_cdev_by_mountpath(const char *path);
 
-- 
2.39.5




More information about the barebox mailing list