提交 bedf78c4 编写于 作者: S Sun Ke 提交者: Jens Axboe

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: NSun Ke <sunke32@huawei.com>
Suggested-by: NMarkus Elfring <Markus.Elfring@web.de>
Reviewed-by: NJosef Bacik <josef@toxicpanda.com>
Link: https://lore.kernel.org/r/20210512114331.1233964-3-sunke32@huawei.comSigned-off-by: NJens Axboe <axboe@kernel.dk>
上级 79ebe911
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册