]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[TIPC]: Improved performance of error checking during socket creation.
authorAllan Stephens <allan.stephens@windriver.com>
Mon, 26 Jun 2006 06:47:18 +0000 (23:47 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 26 Jun 2006 06:47:18 +0000 (23:47 -0700)
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Per Liden <per.liden@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/socket.c

index 8cefacb55aade9c8f376e08c90bd8715b9c54fcc..a1f22100a616110b7237534ed6a7d715b26061e4 100644 (file)
@@ -169,12 +169,6 @@ static int tipc_create(struct socket *sock, int protocol)
        struct sock *sk;
         u32 ref;
 
-       if ((sock->type != SOCK_STREAM) && 
-           (sock->type != SOCK_SEQPACKET) &&
-           (sock->type != SOCK_DGRAM) &&
-           (sock->type != SOCK_RDM))
-               return -EPROTOTYPE;
-
        if (unlikely(protocol != 0))
                return -EPROTONOSUPPORT;
 
@@ -199,6 +193,9 @@ static int tipc_create(struct socket *sock, int protocol)
                sock->ops = &msg_ops;
                sock->state = SS_READY;
                break;
+       default:
+               tipc_deleteport(ref);
+               return -EPROTOTYPE;
        }
 
        sk = sk_alloc(AF_TIPC, GFP_KERNEL, &tipc_proto, 1);