From: Sun Ke Date: Wed, 12 May 2021 11:43:31 +0000 (+0800) Subject: nbd: share nbd_put and return by goto put_nbd X-Git-Tag: howlett/maple/20220722_2~3141^2~4 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bedf78c4cbbbb65e42ede5ca2bd21887ef5b7060;p=users%2Fjedix%2Flinux-maple.git 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 Suggested-by: Markus Elfring Reviewed-by: Josef Bacik Link: https://lore.kernel.org/r/20210512114331.1233964-3-sunke32@huawei.com Signed-off-by: Jens Axboe --- 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; }