1
0
Fork 0

[AF_PACKET]: Fix minor code duplication

Simplify some code by eliminating duplicate if-else clauses in
packet_do_bind().

Signed-off-by: Urs Thuermann <urs@isnogud.escape.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
hifive-unleashed-5.1
Urs Thuermann 2007-11-12 21:05:20 -08:00 committed by David S. Miller
parent 57ce45dd16
commit be85d4ad8a
1 changed files with 5 additions and 11 deletions

View File

@ -881,20 +881,14 @@ 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) {
dev_add_pack(&po->prot_hook);
sock_hold(sk);
po->running = 1;
} else {
sk->sk_err = ENETDOWN;
if (!sock_flag(sk, SOCK_DEAD))
sk->sk_error_report(sk);
}
} else {
if (!dev || (dev->flags & IFF_UP)) {
dev_add_pack(&po->prot_hook);
sock_hold(sk);
po->running = 1;
} else {
sk->sk_err = ENETDOWN;
if (!sock_flag(sk, SOCK_DEAD))
sk->sk_error_report(sk);
}
out_unlock: