Commit c47078d6 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

tcp: remove redundant SOCK_DONE checks

In both tcp_splice_read() and tcp_recvmsg(), we already test
sock_flag(sk, SOCK_DONE) right before evaluating sk->sk_state,
so "!sock_flag(sk, SOCK_DONE)" is always true.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3d907eaf
...@@ -817,8 +817,7 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, ...@@ -817,8 +817,7 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
* This occurs when user tries to read * This occurs when user tries to read
* from never connected socket. * from never connected socket.
*/ */
if (!sock_flag(sk, SOCK_DONE)) ret = -ENOTCONN;
ret = -ENOTCONN;
break; break;
} }
if (!timeo) { if (!timeo) {
...@@ -2042,13 +2041,10 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock, ...@@ -2042,13 +2041,10 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
break; break;
if (sk->sk_state == TCP_CLOSE) { if (sk->sk_state == TCP_CLOSE) {
if (!sock_flag(sk, SOCK_DONE)) { /* This occurs when user tries to read
/* This occurs when user tries to read * from never connected socket.
* from never connected socket. */
*/ copied = -ENOTCONN;
copied = -ENOTCONN;
break;
}
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment