diff --git a/net/socket/setsockopt.c b/net/socket/setsockopt.c index c6edf82aa9..2e1e5df809 100644 --- a/net/socket/setsockopt.c +++ b/net/socket/setsockopt.c @@ -74,13 +74,6 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option, { FAR struct socket_conn_s *conn = psock->s_conn; - /* Verify that the socket option if valid (but might not be supported ) */ - - if (!value) - { - return -EFAULT; - } - /* Process the options always handled locally */ switch (option) @@ -296,6 +289,13 @@ int psock_setsockopt(FAR struct socket *psock, int level, int option, { int ret = -ENOPROTOOPT; + /* Verify that the socket option if valid (but might not be supported ) */ + + if (!value) + { + return -EFAULT; + } + /* Verify that the sockfd corresponds to valid, allocated socket */ if (psock == NULL || psock->s_conn == NULL)