From: Marcel Holtmann <marcel@holtmann.org>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 2/3] Bluetooth: Split error handling for SCO listen sockets
Date: Thu, 19 Apr 2012 13:43:52 +0200 [thread overview]
Message-ID: <1334835833-21828-2-git-send-email-marcel@holtmann.org> (raw)
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>
---
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 32c0e31..2fb9636 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -540,11 +540,16 @@ static int sco_sock_listen(struct socket *sock, int backlog)
lock_sock(sk);
- if (sk->sk_state != BT_BOUND || sock->type != SOCK_SEQPACKET) {
+ if (sk->sk_state != BT_BOUND) {
err = -EBADFD;
goto done;
}
+ if (sk->sk_type != SOCK_SEQPACKET) {
+ err = -EINVAL;
+ goto done;
+ }
+
sk->sk_max_ack_backlog = backlog;
sk->sk_ack_backlog = 0;
sk->sk_state = BT_LISTEN;
--
1.7.7.6
next reply other threads:[~2012-04-19 11:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-19 11:43 Marcel Holtmann [this message]
2012-04-19 14:39 ` [PATCH 2/3] Bluetooth: Split error handling for SCO listen sockets Gustavo Padovan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1334835833-21828-2-git-send-email-marcel@holtmann.org \
--to=marcel@holtmann.org \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).