net: context: fix return with held lock

An internal early return left a mutex locked.

See https://habr.com/en/company/pvs-studio/blog/495284/ fragment 15.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-04-05 11:38:39 -05:00 committed by Anas Nashif
commit 55daa79ba3

View file

@ -907,7 +907,8 @@ int net_context_connect(struct net_context *context,
if (IS_ENABLED(CONFIG_NET_SOCKETS_PACKET) && if (IS_ENABLED(CONFIG_NET_SOCKETS_PACKET) &&
addr->sa_family == AF_PACKET) { addr->sa_family == AF_PACKET) {
return -EOPNOTSUPP; ret = -EOPNOTSUPP;
goto unlock;
} }
if (net_context_get_state(context) == NET_CONTEXT_LISTENING) { if (net_context_get_state(context) == NET_CONTEXT_LISTENING) {