diff options
author | Benoit Taine <benoit.taine@lip6.fr> | 2014-05-22 10:32:30 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-05-22 15:52:23 -0400 |
commit | d40aa3372f90d478b6166df0321349b5aeb0aea8 (patch) | |
tree | 850ddb4df00cc40eb34f0b2ff2dbfe77d62f774e /fs/nfsd/nfs3xdr.c | |
parent | f35ea0d4b66b789e0edcea634238e9aa31924516 (diff) |
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>
Diffstat (limited to 'fs/nfsd/nfs3xdr.c')
-rw-r--r-- | fs/nfsd/nfs3xdr.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index de6e39e12cb3..e6c01e80325e 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
@@ -278,7 +278,8 @@ void fill_post_wcc(struct svc_fh *fhp) | |||
278 | int | 278 | int |
279 | nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args) | 279 | nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args) |
280 | { | 280 | { |
281 | if (!(p = decode_fh(p, &args->fh))) | 281 | p = decode_fh(p, &args->fh); |
282 | if (!p) | ||
282 | return 0; | 283 | return 0; |
283 | return xdr_argsize_check(rqstp, p); | 284 | return xdr_argsize_check(rqstp, p); |
284 | } | 285 | } |
@@ -287,7 +288,8 @@ int | |||
287 | nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p, | 288 | nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p, |
288 | struct nfsd3_sattrargs *args) | 289 | struct nfsd3_sattrargs *args) |
289 | { | 290 | { |
290 | if (!(p = decode_fh(p, &args->fh))) | 291 | p = decode_fh(p, &args->fh); |
292 | if (!p) | ||
291 | return 0; | 293 | return 0; |
292 | p = decode_sattr3(p, &args->attrs); | 294 | p = decode_sattr3(p, &args->attrs); |
293 | 295 | ||
@@ -315,7 +317,8 @@ int | |||
315 | nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, | 317 | nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, |
316 | struct nfsd3_accessargs *args) | 318 | struct nfsd3_accessargs *args) |
317 | { | 319 | { |
318 | if (!(p = decode_fh(p, &args->fh))) | 320 | p = decode_fh(p, &args->fh); |
321 | if (!p) | ||
319 | return 0; | 322 | return 0; |
320 | args->access = ntohl(*p++); | 323 | args->access = ntohl(*p++); |
321 | 324 | ||
@@ -330,7 +333,8 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p, | |||
330 | int v; | 333 | int v; |
331 | u32 max_blocksize = svc_max_payload(rqstp); | 334 | u32 max_blocksize = svc_max_payload(rqstp); |
332 | 335 | ||
333 | if (!(p = decode_fh(p, &args->fh))) | 336 | p = decode_fh(p, &args->fh); |
337 | if (!p) | ||
334 | return 0; | 338 | return 0; |
335 | p = xdr_decode_hyper(p, &args->offset); | 339 | p = xdr_decode_hyper(p, &args->offset); |
336 | 340 | ||
@@ -360,7 +364,8 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, | |||
360 | unsigned int len, v, hdr, dlen; | 364 | unsigned int len, v, hdr, dlen; |
361 | u32 max_blocksize = svc_max_payload(rqstp); | 365 | u32 max_blocksize = svc_max_payload(rqstp); |
362 | 366 | ||
363 | if (!(p = decode_fh(p, &args->fh))) | 367 | p = decode_fh(p, &args->fh); |
368 | if (!p) | ||
364 | return 0; | 369 | return 0; |
365 | p = xdr_decode_hyper(p, &args->offset); | 370 | p = xdr_decode_hyper(p, &args->offset); |
366 | 371 | ||
@@ -535,7 +540,8 @@ int | |||
535 | nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, | 540 | nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, |
536 | struct nfsd3_readlinkargs *args) | 541 | struct nfsd3_readlinkargs *args) |
537 | { | 542 | { |
538 | if (!(p = decode_fh(p, &args->fh))) | 543 | p = decode_fh(p, &args->fh); |
544 | if (!p) | ||
539 | return 0; | 545 | return 0; |
540 | args->buffer = page_address(*(rqstp->rq_next_page++)); | 546 | args->buffer = page_address(*(rqstp->rq_next_page++)); |
541 | 547 | ||
@@ -558,7 +564,8 @@ int | |||
558 | nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, | 564 | nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, |
559 | struct nfsd3_readdirargs *args) | 565 | struct nfsd3_readdirargs *args) |
560 | { | 566 | { |
561 | if (!(p = decode_fh(p, &args->fh))) | 567 | p = decode_fh(p, &args->fh); |
568 | if (!p) | ||
562 | return 0; | 569 | return 0; |
563 | p = xdr_decode_hyper(p, &args->cookie); | 570 | p = xdr_decode_hyper(p, &args->cookie); |
564 | args->verf = p; p += 2; | 571 | args->verf = p; p += 2; |
@@ -580,7 +587,8 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p, | |||
580 | int len; | 587 | int len; |
581 | u32 max_blocksize = svc_max_payload(rqstp); | 588 | u32 max_blocksize = svc_max_payload(rqstp); |
582 | 589 | ||
583 | if (!(p = decode_fh(p, &args->fh))) | 590 | p = decode_fh(p, &args->fh); |
591 | if (!p) | ||
584 | return 0; | 592 | return 0; |
585 | p = xdr_decode_hyper(p, &args->cookie); | 593 | p = xdr_decode_hyper(p, &args->cookie); |
586 | args->verf = p; p += 2; | 594 | args->verf = p; p += 2; |
@@ -605,7 +613,8 @@ int | |||
605 | nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p, | 613 | nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p, |
606 | struct nfsd3_commitargs *args) | 614 | struct nfsd3_commitargs *args) |
607 | { | 615 | { |
608 | if (!(p = decode_fh(p, &args->fh))) | 616 | p = decode_fh(p, &args->fh); |
617 | if (!p) | ||
609 | return 0; | 618 | return 0; |
610 | p = xdr_decode_hyper(p, &args->offset); | 619 | p = xdr_decode_hyper(p, &args->offset); |
611 | args->count = ntohl(*p++); | 620 | args->count = ntohl(*p++); |