Skip to content

Commit bedf78c

Browse files
sunke-lpaxboe
authored andcommitted
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>
1 parent 79ebe91 commit bedf78c

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/block/nbd.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,12 +2015,11 @@ static int nbd_genl_disconnect(struct sk_buff *skb, struct genl_info *info)
20152015
return -EINVAL;
20162016
}
20172017
mutex_unlock(&nbd_index_mutex);
2018-
if (!refcount_inc_not_zero(&nbd->config_refs)) {
2019-
nbd_put(nbd);
2020-
return 0;
2021-
}
2018+
if (!refcount_inc_not_zero(&nbd->config_refs))
2019+
goto put_nbd;
20222020
nbd_disconnect_and_put(nbd);
20232021
nbd_config_put(nbd);
2022+
put_nbd:
20242023
nbd_put(nbd);
20252024
return 0;
20262025
}

0 commit comments

Comments
 (0)