mptcp: userspace pm: use a single point of exit

Like in all other functions in this file, a single point of exit is used
when extra operations are needed: unlock, decrement refcount, etc.

There is no functional change for the moment but it is better to do the
same here to make sure all cleanups are done in case of intermediate
errors.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Matthieu Baerts 2023-01-25 11:47:24 +01:00 committed by Paolo Abeni
parent ad3493746e
commit 40c71f763f

View file

@ -59,8 +59,8 @@ int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
*/
e = sock_kmalloc(sk, sizeof(*e), GFP_ATOMIC);
if (!e) {
spin_unlock_bh(&msk->pm.lock);
return -ENOMEM;
ret = -ENOMEM;
goto append_err;
}
*e = *entry;
@ -74,6 +74,7 @@ int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
ret = entry->addr.id;
}
append_err:
spin_unlock_bh(&msk->pm.lock);
return ret;
}