SUNRPC: remove an unneeded NULL check in xprt_connect()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 1 Feb 2012 07:46:20 +0000 (10:46 +0300)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 6 Feb 2012 23:47:59 +0000 (18:47 -0500)
We check "task->tk_rqstp" and then we dereference it without checking on
the next line.  The only caller is call_connect() and that has a check
which prevents it from calling xprt_connect() with a NULL.

                if (task->tk_status < 0)
                        return;

If "task->tk_rqstp" were NULL then "tk_status" would be -EAGAIN.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
net/sunrpc/xprt.c

index 839f6ef2326bddaac6fea10b7d1ed97cce776cea..efe5495ecf6501b6ab84c84930757765fe48b291 100644 (file)
@@ -715,9 +715,7 @@ void xprt_connect(struct rpc_task *task)
        if (xprt_connected(xprt))
                xprt_release_write(xprt, task);
        else {
-               if (task->tk_rqstp)
-                       task->tk_rqstp->rq_bytes_sent = 0;
-
+               task->tk_rqstp->rq_bytes_sent = 0;
                task->tk_timeout = task->tk_rqstp->rq_timeout;
                rpc_sleep_on(&xprt->pending, task, xprt_connect_status);