Commit be85d4ad authored by Urs Thuermann's avatar Urs Thuermann Committed by David S. Miller

[AF_PACKET]: Fix minor code duplication

Simplify some code by eliminating duplicate if-else clauses in
packet_do_bind().
Signed-off-by: default avatarUrs Thuermann <urs@isnogud.escape.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 57ce45dd
......@@ -881,8 +881,7 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc
if (protocol == 0)
goto out_unlock;
if (dev) {
if (dev->flags&IFF_UP) {
if (!dev || (dev->flags & IFF_UP)) {
dev_add_pack(&po->prot_hook);
sock_hold(sk);
po->running = 1;
......@@ -891,11 +890,6 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc
if (!sock_flag(sk, SOCK_DEAD))
sk->sk_error_report(sk);
}
} else {
dev_add_pack(&po->prot_hook);
sock_hold(sk);
po->running = 1;
}
out_unlock:
spin_unlock(&po->bind_lock);
......
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