All of lore.kernel.org
 help / color / mirror / Atom feed
From: j223yang@asset.uwaterloo.ca
To: linux-nfs@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [patch]xprt: remove redundant checks
Date: Wed, 16 Mar 2011 02:45:09 -0400	[thread overview]
Message-ID: <20110316064509.GA1498@asset.uwaterloo.ca> (raw)

'req' is already dereferenced in 
'struct rpc_xprt *xprt = req->rq_xprt;',
but check again later in the function.
The patch removes these redundant checks.

Signed-off-by: Jinqiu Yang <crindy646@gmail.com>
---
 xprt.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/net/sunrpt/xprt.c b/net/sunrpt/xprt.c
--- a/net/sunrpc/xprt.c	2011-03-16 00:10:08.764164573 -0400
+++ b/net/sunrpt/xprt.c	2011-03-16 02:33:38.559164414 -0400
@@ -202,10 +202,8 @@ int xprt_reserve_xprt(struct rpc_task *t
 		goto out_sleep;
 	}
 	xprt->snd_task = task;
-	if (req) {
-		req->rq_bytes_sent = 0;
-		req->rq_ntrans++;
-	}
+	req->rq_bytes_sent = 0;
+	req->rq_ntrans++;
 	return 1;
 
 out_sleep:
@@ -213,7 +211,7 @@ out_sleep:
 			task->tk_pid, xprt);
 	task->tk_timeout = 0;
 	task->tk_status = -EAGAIN;
-	if (req && req->rq_ntrans)
+	if (req->rq_ntrans)
 		rpc_sleep_on(&xprt->resend, task, NULL);
 	else
 		rpc_sleep_on(&xprt->sending, task, NULL);

             reply	other threads:[~2011-03-16  6:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16  6:45 j223yang [this message]
2011-03-16 14:25 ` [patch]xprt: remove redundant checks Trond Myklebust
2011-03-16 14:25   ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110316064509.GA1498@asset.uwaterloo.ca \
    --to=j223yang@asset.uwaterloo.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.