[PATCH master 1/3] fs: add only successful filesystem probes to fs_device_list

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Apr 4 08:55:19 PDT 2025


fs_init_legacy can't fail currently, but if it does in future, we can
end up with a file system added to fs_device_list that wasn't
successfully probed.

Move the list_add_tail to the end to avoid this.

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

diff --git a/fs/fs.c b/fs/fs.c
index 48a6e960e812..4d201d1b0db8 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -782,14 +782,14 @@ static int fs_probe(struct device *dev)
 
 	fsdev->driver = fsdrv;
 
-	list_add_tail(&fsdev->list, &fs_device_list);
-
 	if (IS_ENABLED(CONFIG_FS_LEGACY) && !fsdev->sb.s_root) {
 		ret = fs_init_legacy(fsdev);
 		if (ret)
 			return ret;
 	}
 
+	list_add_tail(&fsdev->list, &fs_device_list);
+
 	return 0;
 }
 
-- 
2.39.5




More information about the barebox mailing list