diff mbox series

[v2] posix-acl: avoid -Wempty-body warning

Message ID 20210322131402.3117465-1-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series [v2] posix-acl: avoid -Wempty-body warning | expand

Commit Message

Arnd Bergmann March 22, 2021, 1:13 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

The fallthrough comment for an ignored cmpxchg() return value
produces a harmless warning with 'make W=1':

fs/posix_acl.c: In function 'get_acl':
fs/posix_acl.c:127:36: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
  127 |                 /* fall through */ ;
      |                                    ^

Simplify it as a step towards a clean W=1 build.  As all architectures
define cmpxchg() as a statement expression these days, it is no longer
necessary to evaluate its return code, and the if() can just be droped.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/posix_acl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Christian Brauner March 22, 2021, 1:21 p.m. UTC | #1
On Mon, Mar 22, 2021 at 02:13:59PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The fallthrough comment for an ignored cmpxchg() return value
> produces a harmless warning with 'make W=1':
> 
> fs/posix_acl.c: In function 'get_acl':
> fs/posix_acl.c:127:36: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
>   127 |                 /* fall through */ ;
>       |                                    ^
> 
> Simplify it as a step towards a clean W=1 build.  As all architectures
> define cmpxchg() as a statement expression these days, it is no longer
> necessary to evaluate its return code, and the if() can just be droped.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Thanks you!
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
diff mbox series

Patch

diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index f3309a7edb49..7f939f6add7d 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -123,8 +123,7 @@  struct posix_acl *get_acl(struct inode *inode, int type)
 	 * to just call ->get_acl to fetch the ACL ourself.  (This is going to
 	 * be an unlikely race.)
 	 */
-	if (cmpxchg(p, ACL_NOT_CACHED, sentinel) != ACL_NOT_CACHED)
-		/* fall through */ ;
+	cmpxchg(p, ACL_NOT_CACHED, sentinel);
 
 	/*
 	 * Normally, the ACL returned by ->get_acl will be cached.