@@ -736,10 +736,17 @@ EXPORT_SYMBOL(nfc_hci_get_clientdata);
static void nfc_hci_failure(struct nfc_hci_dev *hdev, int err)
{
- /*
- * TODO: lower layer has permanent failure.
- * complete potential HCI command or send an empty tag discovered event
- */
+ mutex_lock(&hdev->msg_tx_mutex);
+
+ if (hdev->cmd_pending_msg == NULL) {
+ nfc_driver_failure(hdev->ndev, err);
+ goto exit;
+ }
+
+ __nfc_hci_cmd_completion(hdev, err, NULL);
+
+exit:
+ mutex_unlock(&hdev->msg_tx_mutex);
}
void nfc_hci_driver_failure(struct nfc_hci_dev *hdev, int err)