[PATCH] fs/afs: Fix compilation issues with -Werror=return-type

Jackie Liu liu.yun at linux.dev
Sun Aug 29 06:19:02 PDT 2021


From: Jackie Liu <liuyun01 at kylinos.cn>

fs/afs/dir.c:51:1: error: no return statement in function returning non-void [-Werror=return-type]

Reported-by: k2ci <kernel-bot at kylinos.cn>
Fixes: f3ddee8dc4e2 ("afs: Fix directory handling")
Signed-off-by: Jackie Liu <liuyun01 at kylinos.cn>
---
 fs/afs/dir.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index ac829e63c570..71c549d99abb 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -48,6 +48,11 @@ static void afs_dir_invalidatepage(struct page *page, unsigned int offset,
 static int afs_dir_set_page_dirty(struct page *page)
 {
 	BUG(); /* This should never happen. */
+
+	/* Although will not come here, the compilation will fail with
+	 * -Werror=return-type
+	 */
+	return 1;
 }
 
 const struct file_operations afs_dir_file_operations = {
-- 
2.25.1




More information about the linux-afs mailing list