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

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

commit 1cb11968b7b207806cbfef9012943efae9819258
Author: chao an <[email protected]>
AuthorDate: Tue Feb 7 17:01:31 2023 +0800

    net/ip: fix compile break if enable NET_LOCAL_SCM
    
    1.
    net/slip.c:865:29: warning: unused variable ‘priv’ [-Wunused-variable]
      865 |   FAR struct slip_driver_s *priv =
          |                             ^~~~
    net/slip.c: In function ‘slip_rmmac’:
    net/slip.c:895:29: warning: unused variable ‘priv’ [-Wunused-variable]
      895 |   FAR struct slip_driver_s *priv =
          |                             ^~~~
    2.
    local/local_sendmsg.c: In function ‘local_sendmsg’:
    local/local_sendmsg.c:423:18: warning: ‘count’ may be used uninitialized in 
this function [-Wmaybe-uninitialized]
      423 |           return count;
          |                  ^~~~~
    local/local_sendmsg.c:131:11: warning: ‘i’ may be used uninitialized in 
this function [-Wmaybe-uninitialized]
      131 |   while (i-- > 0)
          |          ~^~
    local/local_sendmsg.c:71:7: note: ‘i’ was declared here
       71 |   int i;
          |       ^
    
    Signed-off-by: chao an <[email protected]>
---
 drivers/net/slip.c        | 6 ------
 net/local/local_sendmsg.c | 6 +++---
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index ba6cd8db91..c15220018a 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -862,9 +862,6 @@ static int slip_txavail(FAR struct net_driver_s *dev)
 #ifdef CONFIG_NET_MCASTGROUP
 static int slip_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
 {
-  FAR struct slip_driver_s *priv =
-    (FAR struct slip_driver_s *)dev->d_private;
-
   /* Add the MAC address to the hardware multicast routing table */
 
   return OK;
@@ -892,9 +889,6 @@ static int slip_addmac(FAR struct net_driver_s *dev, FAR 
const uint8_t *mac)
 #ifdef CONFIG_NET_MCASTGROUP
 static int slip_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
 {
-  FAR struct slip_driver_s *priv =
-    (FAR struct slip_driver_s *)dev->d_private;
-
   /* Add the MAC address to the hardware multicast routing table */
 
   return OK;
diff --git a/net/local/local_sendmsg.c b/net/local/local_sendmsg.c
index eed2d22a81..8178731ec0 100644
--- a/net/local/local_sendmsg.c
+++ b/net/local/local_sendmsg.c
@@ -65,10 +65,10 @@ static int local_sendctl(FAR struct local_conn_s *conn,
   FAR struct file *filep2;
   FAR struct file *filep;
   struct cmsghdr *cmsg;
-  int count;
+  int count = 0;
   int *fds;
   int ret;
-  int i;
+  int i = 0;
 
   net_lock();
 
@@ -412,7 +412,7 @@ ssize_t local_sendmsg(FAR struct socket *psock, FAR struct 
msghdr *msg,
   size_t len = msg->msg_iovlen;
 #ifdef CONFIG_NET_LOCAL_SCM
   FAR struct local_conn_s *conn = psock->s_conn;
-  int count;
+  int count = 0;
 
   if (msg->msg_control &&
       msg->msg_controllen > sizeof(struct cmsghdr))

Reply via email to