diff options
author | Sun Ke <sunke32@huawei.com> | 2021-05-12 14:43:31 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-05-12 17:42:43 +0300 |
commit | bedf78c4cbbbb65e42ede5ca2bd21887ef5b7060 (patch) | |
tree | 684d227ab72a6f78014eb2c2415351dc82c9275f /drivers/block | |
parent | 79ebe9110fa458d58f1fceb078e2068d7ad37390 (diff) | |
download | linux-bedf78c4cbbbb65e42ede5ca2bd21887ef5b7060.tar.xz |
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 <sunke32@huawei.com>
Suggested-by: Markus Elfring <Markus.Elfring@web.de>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Link: https://lore.kernel.org/r/20210512114331.1233964-3-sunke32@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/nbd.c | 7 |
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; } |