Merge tag 'hwmon-for-v6.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/groec...
[linux-block.git] / net / bluetooth / hci_event.c
index 485c814cf44aa04123d57a428a6e1a4d6de946a4..6643c9c20fa4652575efb2c5b556709a1c012806 100644 (file)
@@ -4179,6 +4179,17 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, void *data,
                }
        }
 
+       if (i == ARRAY_SIZE(hci_cc_table)) {
+               /* Unknown opcode, assume byte 0 contains the status, so
+                * that e.g. __hci_cmd_sync() properly returns errors
+                * for vendor specific commands send by HCI drivers.
+                * If a vendor doesn't actually follow this convention we may
+                * need to introduce a vendor CC table in order to properly set
+                * the status.
+                */
+               *status = skb->data[0];
+       }
+
        handle_cmd_cnt_and_timer(hdev, ev->ncmd);
 
        hci_req_cmd_complete(hdev, *opcode, *status, req_complete,
@@ -5790,7 +5801,7 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status,
         */
        hci_dev_clear_flag(hdev, HCI_LE_ADV);
 
-       conn = hci_lookup_le_connect(hdev);
+       conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, bdaddr);
        if (!conn) {
                /* In case of error status and there is no connection pending
                 * just unlock as there is nothing to cleanup.