Skip to content

Commit

Permalink
Bluetooth: Use chan->state instead of sk->sk_state
Browse files Browse the repository at this point in the history
These vars are kept in sync so we can use chan->state here.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Gustavo Padovan authored and Johan Hedberg committed Jun 5, 2012
1 parent 54a59aa commit 0797e01
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions net/bluetooth/l2cap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1442,21 +1442,17 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
goto done;
}

lock_sock(sk);

switch (sk->sk_state) {
switch (chan->state) {
case BT_CONNECT:
case BT_CONNECT2:
case BT_CONFIG:
/* Already connecting */
err = 0;
release_sock(sk);
goto done;

case BT_CONNECTED:
/* Already connected */
err = -EISCONN;
release_sock(sk);
goto done;

case BT_OPEN:
Expand All @@ -1466,13 +1462,12 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,

default:
err = -EBADFD;
release_sock(sk);
goto done;
}

/* Set destination address and psm */
lock_sock(sk);
bacpy(&bt_sk(sk)->dst, dst);

release_sock(sk);

chan->psm = psm;
Expand Down

0 comments on commit 0797e01

Please sign in to comment.