net/tcp/netdev/mld: correct the netlock handling

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-02-03 15:23:52 +08:00 committed by Alan Carvalho de Assis
parent b04b2f1bc8
commit 56b5ae0640
3 changed files with 6 additions and 4 deletions

View File

@ -343,6 +343,7 @@ static void mld_polldog_work(FAR void *arg)
fwarn("WARNING: No device associated with ifindex=%d\n",
group->ifindex);
net_unlock();
return;
}

View File

@ -375,6 +375,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
ifindex = get_ifindex();
if (ifindex < 0)
{
net_unlock();
return ifindex;
}

View File

@ -425,6 +425,7 @@ static inline int tcp_ipv4_bind(FAR struct tcp_conn_s *conn,
if (port < 0)
{
nerr("ERROR: tcp_selectport failed: %d\n", port);
net_unlock();
return port;
}
@ -448,11 +449,10 @@ static inline int tcp_ipv4_bind(FAR struct tcp_conn_s *conn,
conn->lport = 0;
net_ipv4addr_copy(conn->u.ipv4.laddr, INADDR_ANY);
return ret;
}
net_unlock();
return OK;
return ret;
}
#endif /* CONFIG_NET_IPv4 */
@ -492,6 +492,7 @@ static inline int tcp_ipv6_bind(FAR struct tcp_conn_s *conn,
if (port < 0)
{
nerr("ERROR: tcp_selectport failed: %d\n", port);
net_unlock();
return port;
}
@ -515,11 +516,10 @@ static inline int tcp_ipv6_bind(FAR struct tcp_conn_s *conn,
conn->lport = 0;
net_ipv6addr_copy(conn->u.ipv6.laddr, g_ipv6_unspecaddr);
return ret;
}
net_unlock();
return OK;
return ret;
}
#endif /* CONFIG_NET_IPv6 */