Commit 85418fef authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg

Bluetooth: btusb: Use bt_dev_err for Intel firmware loading errors

Replace the BT_ERR functions with bt_dev_err to get a consistent error
printout that always prefixes the HCI device identifier.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 1313bccf
...@@ -1598,13 +1598,13 @@ static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev, ...@@ -1598,13 +1598,13 @@ static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev,
ret = request_firmware(&fw, fwname, &hdev->dev); ret = request_firmware(&fw, fwname, &hdev->dev);
if (ret < 0) { if (ret < 0) {
if (ret == -EINVAL) { if (ret == -EINVAL) {
BT_ERR("%s Intel firmware file request failed (%d)", bt_dev_err(hdev, "Intel firmware file request failed (%d)",
hdev->name, ret); ret);
return NULL; return NULL;
} }
BT_ERR("%s failed to open Intel firmware file: %s(%d)", bt_dev_err(hdev, "failed to open Intel firmware file: %s (%d)",
hdev->name, fwname, ret); fwname, ret);
/* If the correct firmware patch file is not found, use the /* If the correct firmware patch file is not found, use the
* default firmware patch file instead * default firmware patch file instead
...@@ -1612,8 +1612,8 @@ static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev, ...@@ -1612,8 +1612,8 @@ static const struct firmware *btusb_setup_intel_get_fw(struct hci_dev *hdev,
snprintf(fwname, sizeof(fwname), "intel/ibt-hw-%x.%x.bseq", snprintf(fwname, sizeof(fwname), "intel/ibt-hw-%x.%x.bseq",
ver->hw_platform, ver->hw_variant); ver->hw_platform, ver->hw_variant);
if (request_firmware(&fw, fwname, &hdev->dev) < 0) { if (request_firmware(&fw, fwname, &hdev->dev) < 0) {
BT_ERR("%s failed to open default Intel fw file: %s", bt_dev_err(hdev, "failed to open default fw file: %s",
hdev->name, fwname); fwname);
return NULL; return NULL;
} }
} }
...@@ -1642,7 +1642,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, ...@@ -1642,7 +1642,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev,
* process. * process.
*/ */
if (remain > HCI_COMMAND_HDR_SIZE && *fw_ptr[0] != 0x01) { if (remain > HCI_COMMAND_HDR_SIZE && *fw_ptr[0] != 0x01) {
BT_ERR("%s Intel fw corrupted: invalid cmd read", hdev->name); bt_dev_err(hdev, "Intel fw corrupted: invalid cmd read");
return -EINVAL; return -EINVAL;
} }
(*fw_ptr)++; (*fw_ptr)++;
...@@ -1656,7 +1656,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, ...@@ -1656,7 +1656,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev,
* of command parameter. If not, the firmware file is corrupted. * of command parameter. If not, the firmware file is corrupted.
*/ */
if (remain < cmd->plen) { if (remain < cmd->plen) {
BT_ERR("%s Intel fw corrupted: invalid cmd len", hdev->name); bt_dev_err(hdev, "Intel fw corrupted: invalid cmd len");
return -EFAULT; return -EFAULT;
} }
...@@ -1689,8 +1689,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, ...@@ -1689,8 +1689,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev,
remain -= sizeof(*evt); remain -= sizeof(*evt);
if (remain < evt->plen) { if (remain < evt->plen) {
BT_ERR("%s Intel fw corrupted: invalid evt len", bt_dev_err(hdev, "Intel fw corrupted: invalid evt len");
hdev->name);
return -EFAULT; return -EFAULT;
} }
...@@ -1704,15 +1703,15 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, ...@@ -1704,15 +1703,15 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev,
* file is corrupted. * file is corrupted.
*/ */
if (!evt || !evt_param || remain < 0) { if (!evt || !evt_param || remain < 0) {
BT_ERR("%s Intel fw corrupted: invalid evt read", hdev->name); bt_dev_err(hdev, "Intel fw corrupted: invalid evt read");
return -EFAULT; return -EFAULT;
} }
skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cmd->opcode), cmd->plen, skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cmd->opcode), cmd->plen,
cmd_param, evt->evt, HCI_INIT_TIMEOUT); cmd_param, evt->evt, HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) { if (IS_ERR(skb)) {
BT_ERR("%s sending Intel patch command (0x%4.4x) failed (%ld)", bt_dev_err(hdev, "sending Intel patch command (0x%4.4x) failed (%ld)",
hdev->name, cmd->opcode, PTR_ERR(skb)); cmd->opcode, PTR_ERR(skb));
return PTR_ERR(skb); return PTR_ERR(skb);
} }
...@@ -1721,15 +1720,15 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, ...@@ -1721,15 +1720,15 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev,
* the contents of the event. * the contents of the event.
*/ */
if (skb->len != evt->plen) { if (skb->len != evt->plen) {
BT_ERR("%s mismatch event length (opcode 0x%4.4x)", hdev->name, bt_dev_err(hdev, "mismatch event length (opcode 0x%4.4x)",
le16_to_cpu(cmd->opcode)); le16_to_cpu(cmd->opcode));
kfree_skb(skb); kfree_skb(skb);
return -EFAULT; return -EFAULT;
} }
if (memcmp(skb->data, evt_param, evt->plen)) { if (memcmp(skb->data, evt_param, evt->plen)) {
BT_ERR("%s mismatch event parameter (opcode 0x%4.4x)", bt_dev_err(hdev, "mismatch event parameter (opcode 0x%4.4x)",
hdev->name, le16_to_cpu(cmd->opcode)); le16_to_cpu(cmd->opcode));
kfree_skb(skb); kfree_skb(skb);
return -EFAULT; return -EFAULT;
} }
...@@ -1758,8 +1757,8 @@ static int btusb_setup_intel(struct hci_dev *hdev) ...@@ -1758,8 +1757,8 @@ static int btusb_setup_intel(struct hci_dev *hdev)
*/ */
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT); skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) { if (IS_ERR(skb)) {
BT_ERR("%s sending initial HCI reset command failed (%ld)", bt_dev_err(hdev, "sending initial HCI reset command failed (%ld)",
hdev->name, PTR_ERR(skb)); PTR_ERR(skb));
return PTR_ERR(skb); return PTR_ERR(skb);
} }
kfree_skb(skb); kfree_skb(skb);
...@@ -2089,8 +2088,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) ...@@ -2089,8 +2088,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
* for now only accept this single value. * for now only accept this single value.
*/ */
if (ver.hw_platform != 0x37) { if (ver.hw_platform != 0x37) {
BT_ERR("%s: Unsupported Intel hardware platform (%u)", bt_dev_err(hdev, "Unsupported Intel hardware platform (%u)",
hdev->name, ver.hw_platform); ver.hw_platform);
return -EINVAL; return -EINVAL;
} }
...@@ -2109,8 +2108,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) ...@@ -2109,8 +2108,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
case 0x14: /* QnJ, IcP */ case 0x14: /* QnJ, IcP */
break; break;
default: default:
BT_ERR("%s: Unsupported Intel hardware variant (%u)", bt_dev_err(hdev, "Unsupported Intel hardware variant (%u)",
hdev->name, ver.hw_variant); ver.hw_variant);
return -EINVAL; return -EINVAL;
} }
...@@ -2139,8 +2138,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) ...@@ -2139,8 +2138,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
* choice is to return an error and abort the device initialization. * choice is to return an error and abort the device initialization.
*/ */
if (ver.fw_variant != 0x06) { if (ver.fw_variant != 0x06) {
BT_ERR("%s: Unsupported Intel firmware variant (%u)", bt_dev_err(hdev, "Unsupported Intel firmware variant (%u)",
hdev->name, ver.fw_variant); ver.fw_variant);
return -ENODEV; return -ENODEV;
} }
...@@ -2156,8 +2155,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) ...@@ -2156,8 +2155,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
* that this bootloader does not send them, then abort the setup. * that this bootloader does not send them, then abort the setup.
*/ */
if (params.limited_cce != 0x00) { if (params.limited_cce != 0x00) {
BT_ERR("%s: Unsupported Intel firmware loading method (%u)", bt_dev_err(hdev, "Unsupported Intel firmware loading method (%u)",
hdev->name, params.limited_cce); params.limited_cce);
return -EINVAL; return -EINVAL;
} }
...@@ -2207,14 +2206,13 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) ...@@ -2207,14 +2206,13 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
le16_to_cpu(ver.fw_revision)); le16_to_cpu(ver.fw_revision));
break; break;
default: default:
BT_ERR("%s: Unsupported Intel firmware naming", hdev->name); bt_dev_err(hdev, "Unsupported Intel firmware naming");
return -EINVAL; return -EINVAL;
} }
err = request_firmware(&fw, fwname, &hdev->dev); err = request_firmware(&fw, fwname, &hdev->dev);
if (err < 0) { if (err < 0) {
BT_ERR("%s: Failed to load Intel firmware file (%d)", bt_dev_err(hdev, "Failed to load Intel firmware file (%d)", err);
hdev->name, err);
return err; return err;
} }
...@@ -2240,13 +2238,13 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) ...@@ -2240,13 +2238,13 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
le16_to_cpu(ver.fw_revision)); le16_to_cpu(ver.fw_revision));
break; break;
default: default:
BT_ERR("%s: Unsupported Intel firmware naming", hdev->name); bt_dev_err(hdev, "Unsupported Intel firmware naming");
return -EINVAL; return -EINVAL;
} }
if (fw->size < 644) { if (fw->size < 644) {
BT_ERR("%s: Invalid size of firmware file (%zu)", bt_dev_err(hdev, "Invalid size of firmware file (%zu)",
hdev->name, fw->size); fw->size);
err = -EBADF; err = -EBADF;
goto done; goto done;
} }
...@@ -2277,18 +2275,18 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) ...@@ -2277,18 +2275,18 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
TASK_INTERRUPTIBLE, TASK_INTERRUPTIBLE,
msecs_to_jiffies(5000)); msecs_to_jiffies(5000));
if (err == -EINTR) { if (err == -EINTR) {
BT_ERR("%s: Firmware loading interrupted", hdev->name); bt_dev_err(hdev, "Firmware loading interrupted");
goto done; goto done;
} }
if (err) { if (err) {
BT_ERR("%s: Firmware loading timeout", hdev->name); bt_dev_err(hdev, "Firmware loading timeout");
err = -ETIMEDOUT; err = -ETIMEDOUT;
goto done; goto done;
} }
if (test_bit(BTUSB_FIRMWARE_FAILED, &data->flags)) { if (test_bit(BTUSB_FIRMWARE_FAILED, &data->flags)) {
BT_ERR("%s: Firmware loading failed", hdev->name); bt_dev_err(hdev, "Firmware loading failed");
err = -ENOEXEC; err = -ENOEXEC;
goto done; goto done;
} }
...@@ -2327,12 +2325,12 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) ...@@ -2327,12 +2325,12 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
msecs_to_jiffies(1000)); msecs_to_jiffies(1000));
if (err == -EINTR) { if (err == -EINTR) {
BT_ERR("%s: Device boot interrupted", hdev->name); bt_dev_err(hdev, "Device boot interrupted");
return -EINTR; return -EINTR;
} }
if (err) { if (err) {
BT_ERR("%s: Device boot timeout", hdev->name); bt_dev_err(hdev, "Device boot timeout");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -2392,8 +2390,7 @@ static int btusb_shutdown_intel(struct hci_dev *hdev) ...@@ -2392,8 +2390,7 @@ static int btusb_shutdown_intel(struct hci_dev *hdev)
skb = __hci_cmd_sync(hdev, 0xfc3f, 0, NULL, HCI_INIT_TIMEOUT); skb = __hci_cmd_sync(hdev, 0xfc3f, 0, NULL, HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) { if (IS_ERR(skb)) {
ret = PTR_ERR(skb); ret = PTR_ERR(skb);
BT_ERR("%s: turning off Intel device LED failed (%ld)", bt_dev_err(hdev, "turning off Intel device LED failed");
hdev->name, ret);
return ret; return ret;
} }
kfree_skb(skb); kfree_skb(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment