Netdev List
 help / color / mirror / Atom feed
* [PATCH] [AF_PACKET] Fix minor code duplication
@ 2007-11-09  7:06 Urs Thuermann
  2007-11-13  5:05 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Urs Thuermann @ 2007-11-09  7:06 UTC (permalink / raw)
  To: netdev

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


Signed-off-by: Urs Thuermann <urs@isnogud.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:

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-13  5:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-09  7:06 [PATCH] [AF_PACKET] Fix minor code duplication Urs Thuermann
2007-11-13  5:05 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox