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

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

commit 7b528d903cba633d75562235e4aa18a656c77751
Author: wangjinjing1 <[email protected]>
AuthorDate: Thu Mar 20 14:49:42 2025 +0800

    net/can: fix compile error
    
    variable "conn" not define if CONFIG_NET_SEND_BUFSIZE > 0
    
    Signed-off-by: wangjinjing1 <[email protected]>
---
 net/can/can_sendmsg_buffered.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/can/can_sendmsg_buffered.c b/net/can/can_sendmsg_buffered.c
index 8b2381f7b18..87d5c9ee2ef 100644
--- a/net/can/can_sendmsg_buffered.c
+++ b/net/can/can_sendmsg_buffered.c
@@ -426,6 +426,10 @@ errout_with_lock:
 
 int psock_can_cansend(FAR struct socket *psock)
 {
+#if CONFIG_NET_SEND_BUFSIZE > 0
+  FAR struct can_conn_s *conn;
+#endif
+
   /* Verify that we received a valid socket */
 
   if (psock == NULL || psock->s_conn == NULL)
@@ -438,10 +442,14 @@ int psock_can_cansend(FAR struct socket *psock)
    * one free IOB to initialize the write buffer head.
    */
 
+#if CONFIG_NET_SEND_BUFSIZE > 0
+  conn = psock->s_conn;
+#endif
+
   if (iob_navail(false) <= 0
-  #if CONFIG_NET_SEND_BUFSIZE > 0
+#if CONFIG_NET_SEND_BUFSIZE > 0
       || iob_get_queue_size(&conn->write_q) >= conn->sndbufs
-  #endif
+#endif
      )
     {
       return -EWOULDBLOCK;

Reply via email to