diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_event.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 142aa61f9c3f..eb99a12948c5 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1779,6 +1779,7 @@ static u8 hci_to_mgmt_reason(u8 err) | |||
1779 | static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | 1779 | static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) |
1780 | { | 1780 | { |
1781 | struct hci_ev_disconn_complete *ev = (void *) skb->data; | 1781 | struct hci_ev_disconn_complete *ev = (void *) skb->data; |
1782 | u8 reason = hci_to_mgmt_reason(ev->reason); | ||
1782 | struct hci_conn *conn; | 1783 | struct hci_conn *conn; |
1783 | 1784 | ||
1784 | BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); | 1785 | 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 | if (ev->status == 0) | 1793 | if (ev->status == 0) |
1793 | conn->state = BT_CLOSED; | 1794 | conn->state = BT_CLOSED; |
1794 | 1795 | ||
1795 | if (test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) { | 1796 | if (ev->status) { |
1796 | if (ev->status) { | 1797 | mgmt_disconnect_failed(hdev, &conn->dst, conn->type, |
1797 | mgmt_disconnect_failed(hdev, &conn->dst, conn->type, | 1798 | conn->dst_type, ev->status); |
1798 | conn->dst_type, ev->status); | 1799 | goto unlock; |
1799 | } else { | ||
1800 | u8 reason = hci_to_mgmt_reason(ev->reason); | ||
1801 | |||
1802 | mgmt_device_disconnected(hdev, &conn->dst, conn->type, | ||
1803 | conn->dst_type, reason); | ||
1804 | } | ||
1805 | } | 1800 | } |
1806 | 1801 | ||
1802 | if (test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) | ||
1803 | mgmt_device_disconnected(hdev, &conn->dst, conn->type, | ||
1804 | conn->dst_type, reason); | ||
1805 | |||
1807 | if (ev->status == 0) { | 1806 | if (ev->status == 0) { |
1808 | u8 type = conn->type; | 1807 | u8 type = conn->type; |
1809 | 1808 | ||