提交 abf54a50 编写于 作者: A Andre Guedes 提交者: Gustavo Padovan

Bluetooth: Remove unneeded check in hci_disconn_complete_evt()

According to b644ba33 (patch that introduced HCI_CONN_MGMT_CONNECTED
flag), the HCI_CONN_MGMT_CONNECTED flag tracks when mgmt has been
notified about the connection.

That being said, there is no point in calling mgmt_disconnect_failed()
conditionally based on this flag. mgmt_disconnect_failed() removes
pending MGMT_OP_DISCONNECT commands, it doesn't matter if that
connection was notified or not.

Moreover, if the Disconnection Complete event has status then we have
nothing else to do but call mgmt_disconnect_failed() and return.
Signed-off-by: NAndre Guedes <andre.guedes@openbossa.org>
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
上级 35580d22
...@@ -1779,6 +1779,7 @@ static u8 hci_to_mgmt_reason(u8 err) ...@@ -1779,6 +1779,7 @@ static u8 hci_to_mgmt_reason(u8 err)
static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
{ {
struct hci_ev_disconn_complete *ev = (void *) skb->data; struct hci_ev_disconn_complete *ev = (void *) skb->data;
u8 reason = hci_to_mgmt_reason(ev->reason);
struct hci_conn *conn; struct hci_conn *conn;
BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); BT_DBG("%s status 0x%2.2x", hdev->name, ev->status);
...@@ -1792,18 +1793,16 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -1792,18 +1793,16 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
if (ev->status == 0) if (ev->status == 0)
conn->state = BT_CLOSED; conn->state = BT_CLOSED;
if (test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) { if (ev->status) {
if (ev->status) { mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
mgmt_disconnect_failed(hdev, &conn->dst, conn->type, conn->dst_type, ev->status);
conn->dst_type, ev->status); goto unlock;
} else {
u8 reason = hci_to_mgmt_reason(ev->reason);
mgmt_device_disconnected(hdev, &conn->dst, conn->type,
conn->dst_type, reason);
}
} }
if (test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
mgmt_device_disconnected(hdev, &conn->dst, conn->type,
conn->dst_type, reason);
if (ev->status == 0) { if (ev->status == 0) {
u8 type = conn->type; u8 type = conn->type;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册