Skip to content

Commit

Permalink
net: Fix minor coding problems
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
wengzhe authored and acassis committed Feb 23, 2024
1 parent e0de25f commit 5eb08a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions net/icmpv6/icmpv6_autoconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion net/pkt/pkt_sendmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5eb08a4

Please sign in to comment.