[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ygfpryjaoe9.fsf@janus.isnogud.escape.de>
Date: 09 Nov 2007 08:06:38 +0100
From: Urs Thuermann <urs.thuermann@....de>
To: netdev@...r.kernel.org
Subject: [PATCH] [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@...ogud.escape.de>
--- net-2.6/net/packet/af_packet.c.orig 2007-11-05 13:07:28.000000000 +0100
+++ net-2.6/net/packet/af_packet.c 2007-11-08 12:14:25.000000000 +0100
@@ -886,20 +886,14 @@ static int packet_do_bind(struct sock *s
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:
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists