This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit da0f97b3d23bc475ecaec6e9bb960a2ac2e98af7
Author: Marco Casaroli <[email protected]>
AuthorDate: Thu Nov 26 16:31:05 2026 +0100

    net/netlink: Fix the build of RTM_GETADDR without IPv4.
    
    netlink_addr_callback() declares the response pointer for the whole
    function, but only the IPv4 code uses it.  With CONFIG_NET_IPv6 and
    without CONFIG_NET_IPv4 the build fails with -Werror: "unused variable
    'resp'".
    
    Declare the pointer in the IPv4 block.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 net/netlink/netlink_route.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netlink/netlink_route.c b/net/netlink/netlink_route.c
index c1f81fcab4d..2e7d6547438 100644
--- a/net/netlink/netlink_route.c
+++ b/net/netlink/netlink_route.c
@@ -1220,11 +1220,12 @@ static int netlink_ipv6_addr_callback(FAR struct 
net_driver_s *dev,
 static int netlink_addr_callback(FAR struct net_driver_s *dev, FAR void *arg)
 {
   FAR struct nlroute_info_s *info = arg;
-  FAR struct netlink_response_s *resp;
 
 #ifdef CONFIG_NET_IPv4
   if (info->req->gen.rtgen_family == AF_INET)
     {
+      FAR struct netlink_response_s *resp;
+
       resp = netlink_get_ifaddr(dev, AF_INET, RTM_NEWADDR, &dev->d_ipaddr,
                                 net_ipv4_mask2pref(dev->d_netmask),
                                 info->req);

Reply via email to