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 <andre.przywara@arm.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
Andre Przywara 2015-04-23 17:17:40 +01:00 committed by Trond Myklebust
parent c456aacf3c
commit c775707483
1 changed files with 4 additions and 7 deletions

View File

@ -3096,16 +3096,13 @@ int nfs4_proc_get_rootfh(struct nfs_server *server, struct nfs_fh *fhandle,
struct nfs_fsinfo *info, struct nfs_fsinfo *info,
bool auth_probe) bool auth_probe)
{ {
int status; int status = 0;
switch (auth_probe) { if (!auth_probe)
case false:
status = nfs4_lookup_root(server, fhandle, info); status = nfs4_lookup_root(server, fhandle, info);
if (status != -NFS4ERR_WRONGSEC)
break; if (auth_probe || status == NFS4ERR_WRONGSEC)
default:
status = nfs4_do_find_root_sec(server, fhandle, info); status = nfs4_do_find_root_sec(server, fhandle, info);
}
if (status == 0) if (status == 0)
status = nfs4_server_capabilities(server, fhandle); status = nfs4_server_capabilities(server, fhandle);