Skip to content

Commit

Permalink
nbd: share nbd_put and return by goto put_nbd
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sun Ke authored and Jens Axboe committed May 12, 2021
1 parent 79ebe91 commit bedf78c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit bedf78c

Please sign in to comment.