Skip to content

Commit c775707

Browse files
Andre-ARMtrondmypd
authored andcommitted
fs/nfs: fix new compiler warning about boolean in switch
The brand new GCC 5.1.0 warns by default on using a boolean in the switch condition. This results in the following warning: fs/nfs/nfs4proc.c: In function 'nfs4_proc_get_rootfh': fs/nfs/nfs4proc.c:3100:10: warning: switch condition has boolean value [-Wswitch-bool] switch (auth_probe) { ^ This code was obviously using switch to make use of the fall-through semantics (without the usual comment, though). Rewrite that code using if statements to avoid the warning and make the code a bit more readable on the way. Signed-off-by: Andre Przywara <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent c456aac commit c775707

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

fs/nfs/nfs4proc.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3096,16 +3096,13 @@ int nfs4_proc_get_rootfh(struct nfs_server *server, struct nfs_fh *fhandle,
30963096
struct nfs_fsinfo *info,
30973097
bool auth_probe)
30983098
{
3099-
int status;
3099+
int status = 0;
31003100

3101-
switch (auth_probe) {
3102-
case false:
3101+
if (!auth_probe)
31033102
status = nfs4_lookup_root(server, fhandle, info);
3104-
if (status != -NFS4ERR_WRONGSEC)
3105-
break;
3106-
default:
3103+
3104+
if (auth_probe || status == NFS4ERR_WRONGSEC)
31073105
status = nfs4_do_find_root_sec(server, fhandle, info);
3108-
}
31093106

31103107
if (status == 0)
31113108
status = nfs4_server_capabilities(server, fhandle);

0 commit comments

Comments
 (0)