[-mmots] initramfs: fix a compilation error
diff mbox series

Message ID 20190328014806.36375-1-cai@lca.pw
State In Next
Commit a98778d9c7e355c2eaeccfac121917e5ff766d16
Headers show
Series
  • [-mmots] initramfs: fix a compilation error
Related show

Commit Message

Qian Cai March 28, 2019, 1:48 a.m. UTC
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 <cai@lca.pw>
---
 init/initramfs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch
diff mbox series

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)