]> git.karo-electronics.de Git - linux-beck.git/commitdiff
net/irda: remove pointless assignment/check
authorVegard Nossum <vegard.nossum@oracle.com>
Fri, 19 Aug 2016 16:08:57 +0000 (18:08 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 20 Aug 2016 01:07:24 +0000 (18:07 -0700)
We've already set sk to sock->sk and dereferenced it, so if it's NULL
we would have crashed already. Moreover, if it was NULL we would have
crashed anyway when jumping to 'out' and trying to unlock the sock.
Furthermore, if we had assigned a different value to 'sk' we would
have been calling lock_sock() and release_sock() on different sockets.

My conclusion is that these two lines are complete nonsense and only
serve to confuse the reader.

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/irda/af_irda.c

index 8d2f7c9b491da5b7e7b13f90f2aa9c5d88f84faf..db639690c205540b5f443e25e08dca1bc8caf356 100644 (file)
@@ -845,9 +845,6 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags)
        if (sock->state != SS_UNCONNECTED)
                goto out;
 
-       if ((sk = sock->sk) == NULL)
-               goto out;
-
        err = -EOPNOTSUPP;
        if ((sk->sk_type != SOCK_STREAM) && (sk->sk_type != SOCK_SEQPACKET) &&
            (sk->sk_type != SOCK_DGRAM))