lockd: remove redundant check on block
diff mbox

Message ID 20170408170959.19805-1-colin.king@canonical.com
State New
Headers show

Commit Message

Colin King April 8, 2017, 5:09 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

A null check followed by a return is being performed already, so block
is always non-null at the second check on block, hence we can remove
this redundant null-check (Detected by PVS-Studio).  Also re-work
comment to clean up a check-patch warning.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/lockd/svclock.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

J. Bruce Fields April 25, 2017, 8:56 p.m. UTC | #1
On Sat, Apr 08, 2017 at 06:09:59PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> A null check followed by a return is being performed already, so block
> is always non-null at the second check on block, hence we can remove
> this redundant null-check (Detected by PVS-Studio).  Also re-work
> comment to clean up a check-patch warning.

Thanks, applying for 4.12.--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 5581e020644b..3507c80d1d4b 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -870,15 +870,15 @@  nlmsvc_grant_reply(struct nlm_cookie *cookie, __be32 status)
 	if (!(block = nlmsvc_find_block(cookie)))
 		return;
 
-	if (block) {
-		if (status == nlm_lck_denied_grace_period) {
-			/* Try again in a couple of seconds */
-			nlmsvc_insert_block(block, 10 * HZ);
-		} else {
-			/* Lock is now held by client, or has been rejected.
-			 * In both cases, the block should be removed. */
-			nlmsvc_unlink_block(block);
-		}
+	if (status == nlm_lck_denied_grace_period) {
+		/* Try again in a couple of seconds */
+		nlmsvc_insert_block(block, 10 * HZ);
+	} else {
+		/*
+		 * Lock is now held by client, or has been rejected.
+		 * In both cases, the block should be removed.
+		 */
+		nlmsvc_unlink_block(block);
 	}
 	nlmsvc_release_block(block);
 }