* [PATCH] lockd: remove redundant check on block
@ 2017-04-08 17:09 Colin King
2017-04-25 20:56 ` J . Bruce Fields
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-04-08 17:09 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker, J . Bruce Fields, Jeff Layton,
linux-nfs
Cc: kernel-janitors, linux-kernel
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(-)
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);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] lockd: remove redundant check on block
2017-04-08 17:09 [PATCH] lockd: remove redundant check on block Colin King
@ 2017-04-25 20:56 ` J . Bruce Fields
0 siblings, 0 replies; 2+ messages in thread
From: J . Bruce Fields @ 2017-04-25 20:56 UTC (permalink / raw)
To: Colin King
Cc: Trond Myklebust, Anna Schumaker, Jeff Layton, linux-nfs,
kernel-janitors, linux-kernel
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-25 20:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-08 17:09 [PATCH] lockd: remove redundant check on block Colin King
2017-04-25 20:56 ` J . Bruce Fields
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).