Commit 0797e01d authored by Gustavo Padovan's avatar Gustavo Padovan Committed by Johan Hedberg

Bluetooth: Use chan->state instead of sk->sk_state

These vars are kept in sync so we can use chan->state here.
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 54a59aa2
...@@ -1442,21 +1442,17 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, ...@@ -1442,21 +1442,17 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
goto done; goto done;
} }
lock_sock(sk); switch (chan->state) {
switch (sk->sk_state) {
case BT_CONNECT: case BT_CONNECT:
case BT_CONNECT2: case BT_CONNECT2:
case BT_CONFIG: case BT_CONFIG:
/* Already connecting */ /* Already connecting */
err = 0; err = 0;
release_sock(sk);
goto done; goto done;
case BT_CONNECTED: case BT_CONNECTED:
/* Already connected */ /* Already connected */
err = -EISCONN; err = -EISCONN;
release_sock(sk);
goto done; goto done;
case BT_OPEN: case BT_OPEN:
...@@ -1466,13 +1462,12 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, ...@@ -1466,13 +1462,12 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
default: default:
err = -EBADFD; err = -EBADFD;
release_sock(sk);
goto done; goto done;
} }
/* Set destination address and psm */ /* Set destination address and psm */
lock_sock(sk);
bacpy(&bt_sk(sk)->dst, dst); bacpy(&bt_sk(sk)->dst, dst);
release_sock(sk); release_sock(sk);
chan->psm = psm; chan->psm = psm;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment