Re: [PATCH v1 07/19] NFS: Fix compiler warning in nfs_setup_sequence()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2013-07-22 at 16:16 -0400, Chuck Lever wrote:
> On Jul 22, 2013, at 3:03 PM, "Myklebust, Trond" <Trond.Myklebust@xxxxxxxxxx> wrote:
> 
> > On Fri, 2013-07-12 at 12:32 -0400, Chuck Lever wrote:
> >> Clean up.  Squelch compiler warning:
> >> 
> >> linux/fs/nfs/nfs4proc.c: In function ‘nfs4_setup_sequence’:
> >> linux/fs/nfs/nfs4proc.c:703:2: warning: signed and unsigned type in
> >> 	conditional expression [-Wsign-compare]
> >> 
> >> Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
> >> ---
> >> fs/nfs/nfs4proc.c |    2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> >> index 7b2e008..5913e1d 100644
> >> --- a/fs/nfs/nfs4proc.c
> >> +++ b/fs/nfs/nfs4proc.c
> >> @@ -655,7 +655,7 @@ static int nfs4_setup_sequence(const struct nfs_server *server,
> >> 
> >> 	dprintk("--> %s clp %p session %p sr_slot %d\n",
> >> 		__func__, session->clp, session, res->sr_slot ?
> >> -			res->sr_slot->slot_nr : -1);
> >> +			(int)res->sr_slot->slot_nr : -1);
> >> 
> > 
> > Please convert to make it unsigned, and to use NFS4_NO_SLOT instead of
> > '-1'.
> 
> NFS4_NO_SLOT makes sense, but I'm not clear on "make it unsigned".
> 
> Leaving the format as "%d" allows NFS4_NO_SLOT to be displayed as "-1".  So, something like the following one-liner will address the compiler warning, and leave behavior unchanged:
> 
> -			res->sr_slot->slot_nr : -1);
> +			res->sr_slot->slot_nr : NFS4_NO_SLOT);
> 
> That is, unless you prefer NFS4_NO_SLOT displayed in some other way?

Both the slot id and NFS4_NO_SLOT are defined as being of type u32, so
it makes no sense to display a "-1". Just displaying it as 2^32 should
be good enough since this is an obvious "developer only" dprintk.

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com
��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux