The commit 754006569c54 ("initramfs: cleanup populate_rootfs")
introduced a compilation error with CONFIG_BLK_DEV_RAM != y due to
clean_rootfs() is only declared with CONFIG_BLK_DEV_RAM=y.

init/initramfs.c: In function 'populate_rootfs':
init/initramfs.c:659:3: error: implicit declaration of function
'clean_rootfs'; did you mean 'clean_path'?
[-Werror=implicit-function-declaration]
   clean_rootfs();
   ^~~~~~~~~~~~
   clean_path

Signed-off-by: Qian Cai <c...@lca.pw>
---
 init/initramfs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/init/initramfs.c b/init/initramfs.c
index 000e88ca08b7..435a428c2af1 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -610,7 +610,11 @@ static void __init clean_rootfs(void)
        ksys_close(fd);
        kfree(buf);
 }
-#endif
+#else
+static inline void clean_rootfs(void)
+{
+}
+#endif /* CONFIG_BLK_DEV_RAM */
 
 #ifdef CONFIG_BLK_DEV_RAM
 static void populate_initrd_image(char *err)
-- 
2.17.2 (Apple Git-113)

Reply via email to