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 <[email protected]> Suggested-by: Markus Elfring <[email protected]> Reviewed-by: Josef Bacik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 79ebe91 commit bedf78c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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)