[PATCH] fs: avoid setting root or rootopts to literal string "<NULL>"

Sascha Hauer s.hauer at pengutronix.de
Fri Apr 17 01:44:14 PDT 2026


linux.bootargs.root and linux.bootards.rootopts might be unspecified in
which case dev_get_param() returns a literal "<NULL>" string. Avoid
setting root and rootopts to that string.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 fs/fs.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 6a73a5baa2..0c53881a92 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1251,8 +1251,14 @@ void fsdev_get_linux_root_options(struct fs_device *fsdev,
 				  const char **root, const char **rootopts)
 {
 	if (fsdev) {
-		*root = dev_get_param(&fsdev->dev, "linux.bootargs.root");
-		*rootopts = dev_get_param(&fsdev->dev, "linux.bootargs.rootopts");
+		const char *s;
+
+		s = dev_get_param(&fsdev->dev, "linux.bootargs.root");
+		if (s)
+			*root = s;
+		s = dev_get_param(&fsdev->dev, "linux.bootargs.rootopts");
+		if (s)
+			*rootopts = s;
 	}
 }
 
-- 
2.47.3




More information about the barebox mailing list