Skip to content

Commit

Permalink
[TIPC]: Improved performance of error checking during socket creation.
Browse files Browse the repository at this point in the history
Signed-off-by: Allan Stephens <[email protected]>
Signed-off-by: Per Liden <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
ajstephens authored and davem330 committed Jun 26, 2006
1 parent 1303e8f commit 4997865
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down

0 comments on commit 4997865

Please sign in to comment.