diff options
| author | Shigeru Yoshida <[email protected]> | 2024-02-13 13:40:58 +0000 |
|---|---|---|
| committer | Paolo Abeni <[email protected]> | 2024-02-15 12:18:19 +0000 |
| commit | 984328c7657dbf2fea8f67e1171cb93a22d7fc06 (patch) | |
| tree | 0eac7a4a49627fe82d6972beba43ad9355aedd39 /net/tipc | |
| parent | net: phy: aquantia: add AQR111 and AQR111B0 PHY ID (diff) | |
| download | kernel-984328c7657dbf2fea8f67e1171cb93a22d7fc06.tar.gz kernel-984328c7657dbf2fea8f67e1171cb93a22d7fc06.zip | |
tipc: Cleanup tipc_nl_bearer_add() error paths
Consolidate the error paths of tipc_nl_bearer_add() under the common label
if the function holds rtnl_lock.
Signed-off-by: Shigeru Yoshida <[email protected]>
Reviewed-by: Tung Nguyen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'net/tipc')
| -rw-r--r-- | net/tipc/bearer.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 878415c43527..5a526ebafeb4 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -1079,30 +1079,27 @@ int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info) rtnl_lock(); b = tipc_bearer_find(net, name); if (!b) { - rtnl_unlock(); NL_SET_ERR_MSG(info->extack, "Bearer not found"); - return -EINVAL; + err = -EINVAL; + goto out; } #ifdef CONFIG_TIPC_MEDIA_UDP if (attrs[TIPC_NLA_BEARER_UDP_OPTS]) { if (b->media->type_id != TIPC_MEDIA_TYPE_UDP) { - rtnl_unlock(); NL_SET_ERR_MSG(info->extack, "UDP option is unsupported"); - return -EINVAL; + err = -EINVAL; + goto out; } err = tipc_udp_nl_bearer_add(b, attrs[TIPC_NLA_BEARER_UDP_OPTS]); - if (err) { - rtnl_unlock(); - return err; - } } #endif +out: rtnl_unlock(); - return 0; + return err; } int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) |
