net: Fix minor coding problems

Fix minor problems when reading codes:
- icmpv6_autoconfig: Call net_unlock before return
- pkt_sendmsg: Return error for types other than SOCK_RAW

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng 2024-01-23 16:52:30 +08:00 committed by Alan Carvalho de Assis
parent e0de25f82c
commit 5eb08a4b33
2 changed files with 2 additions and 1 deletions

View File

@ -363,6 +363,7 @@ int icmpv6_autoconfig(FAR struct net_driver_s *dev)
ret = netdev_ipv6_add(dev, lladdr, net_ipv6_mask2pref(g_ipv6_llnetmask));
if (ret < 0)
{
net_unlock();
return ret;
}

View File

@ -194,7 +194,7 @@ ssize_t pkt_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg,
/* Only SOCK_RAW is supported */
if (psock->s_type == SOCK_RAW)
if (psock->s_type != SOCK_RAW)
{
/* EDESTADDRREQ. Signifies that the socket is not connection-mode and
* no peer address is set.