summaryrefslogtreecommitdiffstats
path: root/net/packet/af_packet.c
diff options
context:
space:
mode:
authorUrs Thuermann <urs@isnogud.escape.de>2007-11-12 21:05:20 -0800
committerDavid S. Miller <davem@davemloft.net>2007-11-12 21:05:20 -0800
commitbe85d4ad8ab69520e5ca4717c491a311c9eeae59 (patch)
tree3f140cc3bd090d9b3019ef0c7eaec7bd1b95e98a /net/packet/af_packet.c
parent57ce45dd16cd427ac2bdef202daf513bd25d650b (diff)
downloadlinux-be85d4ad8ab69520e5ca4717c491a311c9eeae59.tar.bz2
[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
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: