nfsd: Remove assignments inside conditions

Assignments should not happen inside an if conditional, but in the line
before. This issue was reported by checkpatch.

The semantic patch that makes this change is as follows
(http://coccinelle.lip6.fr/):

// <smpl>

@@
identifier i1;
expression e1;
statement S;
@@
-if(!(i1 = e1)) S
+i1 = e1;
+if(!i1)
+S

// </smpl>

It has been tested by compilation.

Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
Benoit Taine 2014-05-22 16:32:30 +02:00 committed by J. Bruce Fields
parent f35ea0d4b6
commit d40aa3372f
4 changed files with 40 additions and 20 deletions

View File

@ -182,7 +182,8 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessarg
static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p, static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_getaclargs *argp) struct nfsd3_getaclargs *argp)
{ {
if (!(p = nfs2svc_decode_fh(p, &argp->fh))) p = nfs2svc_decode_fh(p, &argp->fh);
if (!p)
return 0; return 0;
argp->mask = ntohl(*p); p++; argp->mask = ntohl(*p); p++;
@ -197,7 +198,8 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
unsigned int base; unsigned int base;
int n; int n;
if (!(p = nfs2svc_decode_fh(p, &argp->fh))) p = nfs2svc_decode_fh(p, &argp->fh);
if (!p)
return 0; return 0;
argp->mask = ntohl(*p++); argp->mask = ntohl(*p++);
if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT) || if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT) ||
@ -218,7 +220,8 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p, static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_fhandle *argp) struct nfsd_fhandle *argp)
{ {
if (!(p = nfs2svc_decode_fh(p, &argp->fh))) p = nfs2svc_decode_fh(p, &argp->fh);
if (!p)
return 0; return 0;
return xdr_argsize_check(rqstp, p); return xdr_argsize_check(rqstp, p);
} }
@ -226,7 +229,8 @@ static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p,
static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_accessargs *argp) struct nfsd3_accessargs *argp)
{ {
if (!(p = nfs2svc_decode_fh(p, &argp->fh))) p = nfs2svc_decode_fh(p, &argp->fh);
if (!p)
return 0; return 0;
argp->access = ntohl(*p++); argp->access = ntohl(*p++);

View File

@ -128,7 +128,8 @@ out:
static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p, static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_getaclargs *args) struct nfsd3_getaclargs *args)
{ {
if (!(p = nfs3svc_decode_fh(p, &args->fh))) p = nfs3svc_decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
args->mask = ntohl(*p); p++; args->mask = ntohl(*p); p++;
@ -143,7 +144,8 @@ static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
unsigned int base; unsigned int base;
int n; int n;
if (!(p = nfs3svc_decode_fh(p, &args->fh))) p = nfs3svc_decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
args->mask = ntohl(*p++); args->mask = ntohl(*p++);
if (args->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT) || if (args->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT) ||

View File

@ -278,7 +278,8 @@ void fill_post_wcc(struct svc_fh *fhp)
int int
nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args) nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args)
{ {
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
return xdr_argsize_check(rqstp, p); return xdr_argsize_check(rqstp, p);
} }
@ -287,7 +288,8 @@ int
nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p, nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_sattrargs *args) struct nfsd3_sattrargs *args)
{ {
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
p = decode_sattr3(p, &args->attrs); p = decode_sattr3(p, &args->attrs);
@ -315,7 +317,8 @@ int
nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_accessargs *args) struct nfsd3_accessargs *args)
{ {
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
args->access = ntohl(*p++); args->access = ntohl(*p++);
@ -330,7 +333,8 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
int v; int v;
u32 max_blocksize = svc_max_payload(rqstp); u32 max_blocksize = svc_max_payload(rqstp);
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
p = xdr_decode_hyper(p, &args->offset); p = xdr_decode_hyper(p, &args->offset);
@ -360,7 +364,8 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
unsigned int len, v, hdr, dlen; unsigned int len, v, hdr, dlen;
u32 max_blocksize = svc_max_payload(rqstp); u32 max_blocksize = svc_max_payload(rqstp);
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
p = xdr_decode_hyper(p, &args->offset); p = xdr_decode_hyper(p, &args->offset);
@ -535,7 +540,8 @@ int
nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_readlinkargs *args) struct nfsd3_readlinkargs *args)
{ {
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
args->buffer = page_address(*(rqstp->rq_next_page++)); args->buffer = page_address(*(rqstp->rq_next_page++));
@ -558,7 +564,8 @@ int
nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_readdirargs *args) struct nfsd3_readdirargs *args)
{ {
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
p = xdr_decode_hyper(p, &args->cookie); p = xdr_decode_hyper(p, &args->cookie);
args->verf = p; p += 2; args->verf = p; p += 2;
@ -580,7 +587,8 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p,
int len; int len;
u32 max_blocksize = svc_max_payload(rqstp); u32 max_blocksize = svc_max_payload(rqstp);
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
p = xdr_decode_hyper(p, &args->cookie); p = xdr_decode_hyper(p, &args->cookie);
args->verf = p; p += 2; args->verf = p; p += 2;
@ -605,7 +613,8 @@ int
nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p, nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_commitargs *args) struct nfsd3_commitargs *args)
{ {
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
p = xdr_decode_hyper(p, &args->offset); p = xdr_decode_hyper(p, &args->offset);
args->count = ntohl(*p++); args->count = ntohl(*p++);

View File

@ -214,7 +214,8 @@ nfssvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
int int
nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args) nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args)
{ {
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
return xdr_argsize_check(rqstp, p); return xdr_argsize_check(rqstp, p);
} }
@ -248,7 +249,8 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
{ {
unsigned int len; unsigned int len;
int v; int v;
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
args->offset = ntohl(*p++); args->offset = ntohl(*p++);
@ -281,7 +283,8 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
unsigned int len, hdr, dlen; unsigned int len, hdr, dlen;
int v; int v;
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
p++; /* beginoffset */ p++; /* beginoffset */
@ -355,7 +358,8 @@ nfssvc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p,
int int
nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readlinkargs *args) nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readlinkargs *args)
{ {
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
args->buffer = page_address(*(rqstp->rq_next_page++)); args->buffer = page_address(*(rqstp->rq_next_page++));
@ -391,7 +395,8 @@ int
nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd_readdirargs *args) struct nfsd_readdirargs *args)
{ {
if (!(p = decode_fh(p, &args->fh))) p = decode_fh(p, &args->fh);
if (!p)
return 0; return 0;
args->cookie = ntohl(*p++); args->cookie = ntohl(*p++);
args->count = ntohl(*p++); args->count = ntohl(*p++);