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

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

commit 589d4a9f8ebfccb433cb4cd03db68c636975fe88
Author: chao an <[email protected]>
AuthorDate: Tue May 30 13:28:05 2023 +0800

    net/semantic/parser: fix compile warning found by sparse
    
    Reference:
    https://linux.die.net/man/1/sparse
    
    Signed-off-by: chao an <[email protected]>
---
 drivers/net/tun.c            | 7 ++++---
 libs/libc/netdb/lib_dn.c     | 2 +-
 net/inet/inet_sockif.c       | 2 +-
 net/ipforward/ipv4_forward.c | 3 ++-
 net/ipforward/ipv6_forward.c | 3 ++-
 net/local/local_sendmsg.c    | 2 +-
 net/netdev/netdev_ioctl.c    | 2 +-
 net/socket/recv.c            | 2 +-
 net/tcp/tcp_conn.c           | 2 +-
 net/udp/udp_conn.c           | 4 ++--
 wireless/bluetooth/bt_gatt.c | 6 +++---
 11 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 0bfdd2d46a..f77ef7583d 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1130,7 +1130,8 @@ static ssize_t tun_read(FAR struct file *filep, FAR char 
*buffer,
  * Name: tun_poll
  ****************************************************************************/
 
-int tun_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
+static int tun_poll(FAR struct file *filep,
+                    FAR struct pollfd *fds, bool setup)
 {
   FAR struct tun_device_s *priv = filep->f_priv;
   pollevent_t eventset;
@@ -1181,7 +1182,7 @@ int tun_poll(FAR struct file *filep, FAR struct pollfd 
*fds, bool setup)
     }
   else
     {
-      priv->poll_fds = 0;
+      priv->poll_fds = NULL;
     }
 
 errout:
@@ -1232,7 +1233,7 @@ static int tun_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
            intf++, free_tuns >>= 1);
 
       ret = tun_dev_init(&g_tun_devices[intf], filep,
-                         *ifr->ifr_name ? ifr->ifr_name : 0,
+                         *ifr->ifr_name ? ifr->ifr_name : NULL,
                          (ifr->ifr_flags & IFF_MASK) == IFF_TUN);
       if (ret != OK)
         {
diff --git a/libs/libc/netdb/lib_dn.c b/libs/libc/netdb/lib_dn.c
index 8e53e5df2a..5f1d0b53f7 100644
--- a/libs/libc/netdb/lib_dn.c
+++ b/libs/libc/netdb/lib_dn.c
@@ -230,7 +230,7 @@ int dn_comp(FAR const char *src, FAR unsigned char *dst, 
int space,
       if (p + 1 < lastdnptr)
         {
           *p++ = dst;
-          *p = 0;
+          *p = NULL;
         }
     }
 
diff --git a/net/inet/inet_sockif.c b/net/inet/inet_sockif.c
index d0b06feeb6..46c612e706 100644
--- a/net/inet/inet_sockif.c
+++ b/net/inet/inet_sockif.c
@@ -1109,7 +1109,7 @@ static int inet_setsockopt(FAR struct socket *psock, int 
level, int option,
  *
  ****************************************************************************/
 
-int inet_listen(FAR struct socket *psock, int backlog)
+static int inet_listen(FAR struct socket *psock, int backlog)
 {
 #if defined(CONFIG_NET_TCP) && defined(NET_TCP_HAVE_STACK)
   FAR struct tcp_conn_s *conn;
diff --git a/net/ipforward/ipv4_forward.c b/net/ipforward/ipv4_forward.c
index 23a8da7418..ac608681ed 100644
--- a/net/ipforward/ipv4_forward.c
+++ b/net/ipforward/ipv4_forward.c
@@ -337,7 +337,8 @@ errout:
  ****************************************************************************/
 
 #ifdef CONFIG_NET_IPFORWARD_BROADCAST
-int ipv4_forward_callback(FAR struct net_driver_s *fwddev, FAR void *arg)
+static int ipv4_forward_callback(FAR struct net_driver_s *fwddev,
+                                 FAR void *arg)
 {
   FAR struct net_driver_s *dev = (FAR struct net_driver_s *)arg;
   FAR struct ipv4_hdr_s *ipv4;
diff --git a/net/ipforward/ipv6_forward.c b/net/ipforward/ipv6_forward.c
index f60988da49..48698a2e7e 100644
--- a/net/ipforward/ipv6_forward.c
+++ b/net/ipforward/ipv6_forward.c
@@ -464,7 +464,8 @@ errout:
  ****************************************************************************/
 
 #ifdef CONFIG_NET_IPFORWARD_BROADCAST
-int ipv6_forward_callback(FAR struct net_driver_s *fwddev, FAR void *arg)
+static int ipv6_forward_callback(FAR struct net_driver_s *fwddev,
+                                 FAR void *arg)
 {
   FAR struct net_driver_s *dev = (FAR struct net_driver_s *)arg;
   FAR struct ipv6_hdr_s *ipv6;
diff --git a/net/local/local_sendmsg.c b/net/local/local_sendmsg.c
index 3a23a08698..490d478718 100644
--- a/net/local/local_sendmsg.c
+++ b/net/local/local_sendmsg.c
@@ -305,7 +305,7 @@ static ssize_t local_sendto(FAR struct socket *psock,
 
   /* The outgoing FIFO should not be open */
 
-  DEBUGASSERT(conn->lc_outfile.f_inode == 0);
+  DEBUGASSERT(conn->lc_outfile.f_inode == NULL);
 
   /* At present, only standard pathname type address are support */
 
diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c
index 6d19058fd4..638daf70ee 100644
--- a/net/netdev/netdev_ioctl.c
+++ b/net/netdev/netdev_ioctl.c
@@ -1423,7 +1423,7 @@ static int netdev_rt_ioctl(FAR struct socket *psock, int 
cmd,
         {
           /* The target address and the netmask are required values */
 
-          if (rtentry == 0)
+          if (rtentry == NULL)
             {
               return -EINVAL;
             }
diff --git a/net/socket/recv.c b/net/socket/recv.c
index 21c6446e65..5b8f7dabb9 100644
--- a/net/socket/recv.c
+++ b/net/socket/recv.c
@@ -58,7 +58,7 @@ ssize_t recv(int sockfd, FAR void *buf, size_t len, int flags)
 {
   /* recv is a cancellation point, but that can all be handled by recvfrom */
 
-  return recvfrom(sockfd, buf, len, flags, NULL, 0);
+  return recvfrom(sockfd, buf, len, flags, NULL, NULL);
 }
 
 #endif /* CONFIG_NET */
diff --git a/net/tcp/tcp_conn.c b/net/tcp/tcp_conn.c
index d786646707..b9cfa904b0 100644
--- a/net/tcp/tcp_conn.c
+++ b/net/tcp/tcp_conn.c
@@ -440,7 +440,7 @@ static inline int tcp_ipv6_bind(FAR struct tcp_conn_s *conn,
  ****************************************************************************/
 
 #if CONFIG_NET_TCP_ALLOC_CONNS > 0
-FAR struct tcp_conn_s *tcp_alloc_conn(void)
+static FAR struct tcp_conn_s *tcp_alloc_conn(void)
 {
   FAR struct tcp_conn_s *conn;
   int i;
diff --git a/net/udp/udp_conn.c b/net/udp/udp_conn.c
index 7c2a631896..63d716f224 100644
--- a/net/udp/udp_conn.c
+++ b/net/udp/udp_conn.c
@@ -77,7 +77,7 @@
 /* The array containing all UDP connections. */
 
 #if CONFIG_NET_UDP_PREALLOC_CONNS > 0
-struct udp_conn_s g_udp_connections[CONFIG_NET_UDP_PREALLOC_CONNS];
+static struct udp_conn_s g_udp_connections[CONFIG_NET_UDP_PREALLOC_CONNS];
 #endif
 
 /* A list of all free UDP connections */
@@ -463,7 +463,7 @@ static inline FAR struct udp_conn_s *
  ****************************************************************************/
 
 #if CONFIG_NET_UDP_ALLOC_CONNS > 0
-FAR struct udp_conn_s *udp_alloc_conn(void)
+static FAR struct udp_conn_s *udp_alloc_conn(void)
 {
   FAR struct udp_conn_s *conn;
   int i;
diff --git a/wireless/bluetooth/bt_gatt.c b/wireless/bluetooth/bt_gatt.c
index 5855ce79c5..684e74c3fa 100644
--- a/wireless/bluetooth/bt_gatt.c
+++ b/wireless/bluetooth/bt_gatt.c
@@ -150,9 +150,9 @@ int bt_gatt_attr_read_service(FAR struct bt_conn_s *conn,
                            sizeof(uuid->u.u128));
 }
 
-int bt_gatt_attr_read_include(FAR struct bt_conn_s *conn,
-                              FAR const struct bt_gatt_attr_s *attr,
-                              FAR void *buf, uint8_t len, uint16_t offset)
+int bt_gatt_attr_read_included(FAR struct bt_conn_s *conn,
+                               FAR const struct bt_gatt_attr_s *attr,
+                               FAR void *buf, uint8_t len, uint16_t offset)
 {
   FAR struct bt_gatt_include_s *incl = attr->user_data;
   struct gatt_incl_s pdu;

Reply via email to