diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2015-11-11 14:44:58 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-11-19 17:50:32 +0100 |
commit | 658aead94bb65c0141391f20f8c24f51e971b6ea (patch) | |
tree | 864845eded7366abbe1c2d15e0e069e37e1b2aef /net/bluetooth | |
parent | 0ad06aa6a7682319bb1adcc187a1fa8db6b2da2c (diff) | |
download | linux-658aead94bb65c0141391f20f8c24f51e971b6ea.tar.bz2 |
Bluetooth: Move check for ongoing connect earlier in hci_connect_le()
This helps simplify the logic in further patches (less cleanups to do
in this failure branch).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_conn.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 673c2254935b..08a291dd0f3a 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -798,6 +798,12 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, return ERR_PTR(-EOPNOTSUPP); } + /* Since the controller supports only one LE connection attempt at a + * time, we return -EBUSY if there is any connection attempt running. + */ + if (hci_lookup_le_connect(hdev)) + return ERR_PTR(-EBUSY); + /* Some devices send ATT messages as soon as the physical link is * established. To be able to handle these ATT messages, the user- * space first establishes the connection and then starts the pairing @@ -821,12 +827,6 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst, } } - /* Since the controller supports only one LE connection attempt at a - * time, we return -EBUSY if there is any connection attempt running. - */ - if (hci_lookup_le_connect(hdev)) - return ERR_PTR(-EBUSY); - /* When given an identity address with existing identity * resolving key, the connection needs to be established * to a resolvable random address. |