lockd: remove redundant check on block
authorColin Ian King <colin.king@canonical.com>
Sat, 8 Apr 2017 17:09:59 +0000 (18:09 +0100)
committerJ. Bruce Fields <bfields@redhat.com>
Tue, 25 Apr 2017 21:25:56 +0000 (17:25 -0400)
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>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/lockd/svclock.c

index 5581e020644bda687f0b4bd09645a058a18d4537..3507c80d1d4b962b579d501201f4cdd060e6248b 100644 (file)
@@ -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);
 }