diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2012-04-19 07:43:52 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo@padovan.org> | 2012-05-09 00:40:37 -0400 |
commit | 7d5d775a55554183448b591a86b1d172ae993b94 (patch) | |
tree | 5fe2dfc616c8217026ccb52ceb4de0b968500bc0 /net/bluetooth/sco.c | |
parent | 6b3af7334bd3c403647606adfb04f6e6bcf1597e (diff) |
Bluetooth: Split error handling for SCO listen sockets
Split the checks for sk->sk_state and sk->sk_type for SCO listen
sockets. This makes the code more readable.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
Diffstat (limited to 'net/bluetooth/sco.c')
-rw-r--r-- | net/bluetooth/sco.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 7bd0947af2fa..a69aa345597e 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -539,11 +539,16 @@ static int sco_sock_listen(struct socket *sock, int backlog) | |||
539 | 539 | ||
540 | lock_sock(sk); | 540 | lock_sock(sk); |
541 | 541 | ||
542 | if (sk->sk_state != BT_BOUND || sock->type != SOCK_SEQPACKET) { | 542 | if (sk->sk_state != BT_BOUND) { |
543 | err = -EBADFD; | 543 | err = -EBADFD; |
544 | goto done; | 544 | goto done; |
545 | } | 545 | } |
546 | 546 | ||
547 | if (sk->sk_type != SOCK_SEQPACKET) { | ||
548 | err = -EINVAL; | ||
549 | goto done; | ||
550 | } | ||
551 | |||
547 | sk->sk_max_ack_backlog = backlog; | 552 | sk->sk_max_ack_backlog = backlog; |
548 | sk->sk_ack_backlog = 0; | 553 | sk->sk_ack_backlog = 0; |
549 | sk->sk_state = BT_LISTEN; | 554 | sk->sk_state = BT_LISTEN; |