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

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

commit 357b1a938aefed21b2c288252489f20feb59723a
Author: wangjinjing1 <[email protected]>
AuthorDate: Fri Mar 6 22:22:40 2026 +0800

    net/can: optimize CAN TX path by removing unnecessary operations
    
    Remove redundant NULL checks for psock and psock->s_conn in can_sendmsg().
    These pointers are already validated by the socket layer before reaching 
this function, so the check is unnecessary overhead.
    
    Signed-off-by: wangjinjing1 <[email protected]>
    Signed-off-by: p-szafonimateusz <[email protected]>
---
 net/can/can_sendmsg_buffered.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/net/can/can_sendmsg_buffered.c b/net/can/can_sendmsg_buffered.c
index d2696a75e3f..40773022a4d 100644
--- a/net/can/can_sendmsg_buffered.c
+++ b/net/can/can_sendmsg_buffered.c
@@ -193,13 +193,6 @@ ssize_t can_sendmsg(FAR struct socket *psock, FAR const 
struct msghdr *msg,
   bool nonblock;
   int ret = OK;
 
-  /* Verify that the sockfd corresponds to valid, allocated socket */
-
-  if (psock == NULL || psock->s_conn == NULL)
-    {
-      return -EBADF;
-    }
-
   /* Only SOCK_RAW is supported */
 
   if (psock->s_type != SOCK_RAW)

Reply via email to