net/netlink: fix build warning if disable CONFIG_NETLINK_ROUTE

netlink/netlink_sockif.c: In function ‘netlink_sendmsg’:
netlink/netlink_sockif.c:676:10: warning: unused variable ‘len’ [-Wunused-variable]
  676 |   size_t len = msg->msg_iov->iov_len;
      |          ^~~

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-01-17 12:16:33 +08:00 committed by Xiang Xiao
parent 0d7f12c489
commit a9d0dd7051

View File

@ -673,7 +673,6 @@ static ssize_t netlink_sendmsg(FAR struct socket *psock,
FAR struct msghdr *msg, int flags) FAR struct msghdr *msg, int flags)
{ {
FAR const void *buf = msg->msg_iov->iov_base; FAR const void *buf = msg->msg_iov->iov_base;
size_t len = msg->msg_iov->iov_len;
FAR const struct sockaddr *to = msg->msg_name; FAR const struct sockaddr *to = msg->msg_name;
socklen_t tolen = msg->msg_namelen; socklen_t tolen = msg->msg_namelen;
FAR struct netlink_conn_s *conn; FAR struct netlink_conn_s *conn;
@ -719,7 +718,8 @@ static ssize_t netlink_sendmsg(FAR struct socket *psock,
{ {
#ifdef CONFIG_NETLINK_ROUTE #ifdef CONFIG_NETLINK_ROUTE
case NETLINK_ROUTE: case NETLINK_ROUTE:
ret = netlink_route_sendto(conn, nlmsg, len, flags, ret = netlink_route_sendto(conn, nlmsg,
msg->msg_iov->iov_len, flags,
(FAR const struct sockaddr_nl *)to, (FAR const struct sockaddr_nl *)to,
tolen); tolen);
break; break;