linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 9p: fix unused-variable warning
@ 2021-12-03 18:58 Arnd Bergmann
       [not found] ` <YaqwdNGlZDBDcg5R@codewreck.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2021-12-03 18:58 UTC (permalink / raw)
  To: David Howells
  Cc: Arnd Bergmann, Eric Van Hensbergen, Latchesar Ionkov,
	Dominique Martinet, Jeff Layton, v9fs-developer, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The folio changes added a variable that is sometimes unused:

fs/9p/vfs_addr.c: In function 'v9fs_release_page':
fs/9p/vfs_addr.c:140:23: error: unused variable 'inode' [-Werror=unused-variable]
  140 |         struct inode *inode = folio_inode(folio);
      |                       ^~~~~

Make this clearer to the compiler by replacing the #ifdef
with an equivalent if(IS_ENABLED()) check.

Fixes: 78525c74d9e7 ("netfs, 9p, afs, ceph: Use folios")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/9p/vfs_addr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 1279970e9157..82ac2ceff06e 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -141,14 +141,17 @@ static int v9fs_release_page(struct page *page, gfp_t gfp)
 
 	if (folio_test_private(folio))
 		return 0;
-#ifdef CONFIG_9P_FSCACHE
+
+	if (!IS_ENABLED(CONFIG_9P_FSCACHE))
+		return 1;
+
 	if (folio_test_fscache(folio)) {
 		if (!(gfp & __GFP_DIRECT_RECLAIM) || !(gfp & __GFP_FS))
 			return 0;
 		folio_wait_fscache(folio);
 	}
 	fscache_note_page_release(v9fs_inode_cookie(V9FS_I(inode)));
-#endif
+
 	return 1;
 }
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] 9p: fix unused-variable warning
       [not found] ` <YaqwdNGlZDBDcg5R@codewreck.org>
@ 2021-12-18 11:05   ` Dominique Martinet
  2021-12-18 13:51   ` David Howells
  1 sibling, 0 replies; 3+ messages in thread
From: Dominique Martinet @ 2021-12-18 11:05 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: David Howells, Arnd Bergmann, Eric Van Hensbergen,
	Latchesar Ionkov, Jeff Layton, v9fs-developer, linux-kernel

Dominique Martinet wrote on Sat, Dec 04, 2021 at 09:04:04AM +0900:
> Arnd Bergmann wrote on Fri, Dec 03, 2021 at 07:58:06PM +0100:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > The folio changes added a variable that is sometimes unused:
> > 
> > fs/9p/vfs_addr.c: In function 'v9fs_release_page':
> > fs/9p/vfs_addr.c:140:23: error: unused variable 'inode' [-Werror=unused-variable]
> >   140 |         struct inode *inode = folio_inode(folio);
> >       |                       ^~~~~
> > 
> > Make this clearer to the compiler by replacing the #ifdef
> > with an equivalent if(IS_ENABLED()) check.
> > 
> > Fixes: 78525c74d9e7 ("netfs, 9p, afs, ceph: Use folios")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Looks good to me, picking it up

Sorry it took me a while to actually do the picking up part, but this
appears to have been a patch for linux-next back then and I didn't
notice because the Fixes tag is incorrect (78525c74d9e7 didn't introduce
the inode variable, it actually fixes a patch that never has been merged)

David since then fixed the warning differently in v2 of the patch (he
moved the fscache_note_page_release() out of the ifdef), so I won't do
anything with this even if in principle I tend to agree that
if(IS_ENABLED()) lead to better compiler coverage

Thanks though!
-- 
Dominique

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] 9p: fix unused-variable warning
       [not found] ` <YaqwdNGlZDBDcg5R@codewreck.org>
  2021-12-18 11:05   ` Dominique Martinet
@ 2021-12-18 13:51   ` David Howells
  1 sibling, 0 replies; 3+ messages in thread
From: David Howells @ 2021-12-18 13:51 UTC (permalink / raw)
  To: Dominique Martinet
  Cc: dhowells, Arnd Bergmann, Arnd Bergmann, Eric Van Hensbergen,
	Latchesar Ionkov, Jeff Layton, v9fs-developer, linux-kernel

Dominique Martinet <asmadeus@codewreck.org> wrote:

> David since then fixed the warning differently in v2 of the patch (he
> moved the fscache_note_page_release() out of the ifdef), so I won't do
> anything with this even if in principle I tend to agree that
> if(IS_ENABLED()) lead to better compiler coverage

Yeah, fscache_note_page_release() compiles out in such a case because
v9fs_inode_cookie() becomes unconditionally NULL if it's disabled.

If you want me to do something different, can you give me an incremental patch
to merge into mine?

David


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-18 13:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 18:58 [PATCH] 9p: fix unused-variable warning Arnd Bergmann
     [not found] ` <YaqwdNGlZDBDcg5R@codewreck.org>
2021-12-18 11:05   ` Dominique Martinet
2021-12-18 13:51   ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).