net/packet: Remove redundant assignment to ret
authorJiapeng Chong <jiapeng.chong@linux.alibaba.com>
Mon, 17 May 2021 10:15:25 +0000 (18:15 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 May 2021 23:03:56 +0000 (16:03 -0700)
Variable ret is set to '0' or '-EBUSY', but this value is never read
as it is not used later on, hence it is a redundant assignment and
can be removed.

Clean up the following clang-analyzer warning:

net/packet/af_packet.c:3936:4: warning: Value stored to 'ret' is never
read [clang-analyzer-deadcode.DeadStores].

net/packet/af_packet.c:3933:4: warning: Value stored to 'ret' is never
read [clang-analyzer-deadcode.DeadStores].

No functional change.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c

index ba96db1..597d798 100644 (file)
@@ -3923,12 +3923,9 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval,
                        return -EFAULT;
 
                lock_sock(sk);
-               if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) {
-                       ret = -EBUSY;
-               } else {
+               if (!po->rx_ring.pg_vec && !po->tx_ring.pg_vec)
                        po->tp_tx_has_off = !!val;
-                       ret = 0;
-               }
+
                release_sock(sk);
                return 0;
        }