Skip to contentSkip to conversation

afs: add a return to afs_dir_set_page_dirty()

PATCH In review [email protected] 2 participants 2 messages Jun 1, 2021 Afs filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 afs: add a return to afs_dir_set_page_dirty()

From: Tom Rix <[email protected]>

With gcc 10.3, this compile error is reported dir.c: In function 'afs_dir_set_page_dirty':
dir.c:51:1: error: no return statement in function
returning non-void [-Werror=return-type]

Even though the code is unreachable, add a return
to silence the error.

---
 fs/afs/dir.c | 1 +
 1 file changed, 1 insertion(+)
fs/afs/dir.c +1 -0
index 78719f2f567e..988766f88d8b 100644
@@ -48,6 +48,7 @@ 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. */
+	return -EINVAL;
 }
 
 const struct file_operations afs_dir_file_operations = {
Signature · 1 line
2.26.3
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · On 6/1/21 7:08 AM, [email protected] wrote:

From: Tom Rix <[email protected]>

With gcc 10.3, this compile error is reported dir.c: In function 'afs_dir_set_page_dirty':
dir.c:51:1: error: no return statement in function
returning non-void [-Werror=return-type]

Even though the code is unreachable, add a return
to silence the error.

or this previous patch:
https://lore.kernel.org/lkml/[email protected]/

but for either of them, ack.

thanks.

Quoted 17 lines
---
 fs/afs/dir.c | 1 +
 1 file changed, 1 insertion(+)
fs/afs/dir.c +1 -0
index 78719f2f567e..988766f88d8b 100644
@@ -48,6 +48,7 @@ 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. */
+	return -EINVAL;
 }
 
 const struct file_operations afs_dir_file_operations = {
Signature · 1 line
~Randy