net/semantic/parser: fix compile warning found by sparse

Reference:
https://linux.die.net/man/1/sparse

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2023-05-30 13:28:05 +08:00 committed by Xiang Xiao
parent fb9b41221d
commit 589d4a9f8e
11 changed files with 19 additions and 16 deletions

View File

@ -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)
{

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 */

View File

@ -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;
}

View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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;