[PATCH] fs: ramfs: do not bother unmounting ramfs on shutdown

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Jun 5 04:26:18 PDT 2025


It's pointless to free memory when we are about to boot a kernel that
will reclaim all memory anyway.

As ramfs only consists of such memory buffers, let's just skip its
freeing.

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

diff --git a/fs/fs.c b/fs/fs.c
index 0f821451103f..4d478eaf1f72 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -835,6 +835,8 @@ static void fs_remove(struct device *dev)
 	int ret;
 
 	if (fsdev->dev.driver) {
+		if (!dev->driver->remove)
+			return;
 		dev->driver->remove(dev);
 		list_del(&fsdev->list);
 	}
diff --git a/fs/ramfs.c b/fs/ramfs.c
index ab3c44270d43..e971f608545c 100644
--- a/fs/ramfs.c
+++ b/fs/ramfs.c
@@ -435,10 +435,6 @@ static int ramfs_probe(struct device *dev)
 	return 0;
 }
 
-static void ramfs_remove(struct device *dev)
-{
-}
-
 static struct fs_driver ramfs_driver = {
 	.read      = ramfs_read,
 	.write     = ramfs_write,
@@ -446,7 +442,6 @@ static struct fs_driver ramfs_driver = {
 	.truncate  = ramfs_truncate,
 	.drv = {
 		.probe  = ramfs_probe,
-		.remove = ramfs_remove,
 		.name = "ramfs",
 	}
 };
-- 
2.39.5




More information about the barebox mailing list