aboutsummaryrefslogtreecommitdiffstats
path: root/net/packet/af_packet.c
diff options
context:
space:
mode:
authorUrs Thuermann <urs@isnogud.escape.de>2007-11-13 00:05:20 -0500
committerDavid S. Miller <davem@davemloft.net>2007-11-13 00:05:20 -0500
commitbe85d4ad8ab69520e5ca4717c491a311c9eeae59 (patch)
tree3f140cc3bd090d9b3019ef0c7eaec7bd1b95e98a /net/packet/af_packet.c
parent57ce45dd16cd427ac2bdef202daf513bd25d650b (diff)
[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>
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r--net/packet/af_packet.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index eb6be5030c70..8a7807dbba01 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -881,20 +881,14 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 protoc
881 if (protocol == 0) 881 if (protocol == 0)
882 goto out_unlock; 882 goto out_unlock;
883 883
884 if (dev) { 884 if (!dev || (dev->flags & IFF_UP)) {
885 if (dev->flags&IFF_UP) {
886 dev_add_pack(&po->prot_hook);
887 sock_hold(sk);
888 po->running = 1;
889 } else {
890 sk->sk_err = ENETDOWN;
891 if (!sock_flag(sk, SOCK_DEAD))
892 sk->sk_error_report(sk);
893 }
894 } else {
895 dev_add_pack(&po->prot_hook); 885 dev_add_pack(&po->prot_hook);
896 sock_hold(sk); 886 sock_hold(sk);
897 po->running = 1; 887 po->running = 1;
888 } else {
889 sk->sk_err = ENETDOWN;
890 if (!sock_flag(sk, SOCK_DEAD))
891 sk->sk_error_report(sk);
898 } 892 }
899 893
900out_unlock: 894out_unlock: