From a9d0dd705196cffed5a12a5da893b573c7216372 Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Mon, 17 Jan 2022 12:16:33 +0800 Subject: [PATCH] net/netlink: fix build warning if disable CONFIG_NETLINK_ROUTE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- net/netlink/netlink_sockif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netlink/netlink_sockif.c b/net/netlink/netlink_sockif.c index a707fd97b4..e6456c875c 100644 --- a/net/netlink/netlink_sockif.c +++ b/net/netlink/netlink_sockif.c @@ -673,7 +673,6 @@ static ssize_t netlink_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg, int flags) { 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; socklen_t tolen = msg->msg_namelen; FAR struct netlink_conn_s *conn; @@ -719,7 +718,8 @@ static ssize_t netlink_sendmsg(FAR struct socket *psock, { #ifdef CONFIG_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, tolen); break;