aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSun Ke <[email protected]>2021-05-12 19:43:31 +0800
committerJens Axboe <[email protected]>2021-05-12 08:42:43 -0600
commitbedf78c4cbbbb65e42ede5ca2bd21887ef5b7060 (patch)
tree684d227ab72a6f78014eb2c2415351dc82c9275f
parent79ebe9110fa458d58f1fceb078e2068d7ad37390 (diff)
nbd: share nbd_put and return by goto put_nbd
Replace the following two statements by the statement “goto put_nbd;” nbd_put(nbd); return 0; Signed-off-by: Sun Ke <[email protected]> Suggested-by: Markus Elfring <[email protected]> Reviewed-by: Josef Bacik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
-rw-r--r--drivers/block/nbd.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 974da561b8e5..45d2c28c8fc8 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -2015,12 +2015,11 @@ static int nbd_genl_disconnect(struct sk_buff *skb, struct genl_info *info)
return -EINVAL;
}
mutex_unlock(&nbd_index_mutex);
- if (!refcount_inc_not_zero(&nbd->config_refs)) {
- nbd_put(nbd);
- return 0;
- }
+ if (!refcount_inc_not_zero(&nbd->config_refs))
+ goto put_nbd;
nbd_disconnect_and_put(nbd);
nbd_config_put(nbd);
+put_nbd:
nbd_put(nbd);
return 0;
}