Commit f0a70a04 authored by Bart Van Assche's avatar Bart Van Assche Committed by Marcel Holtmann

Bluetooth: btusb, hci_intel: Fix wait_on_bit_timeout() return value checks

wait_on_bit_timeout() returns one of the following three values:
* 0 to indicate success.
* -EINTR to indicate that a signal has been received;
* -EAGAIN to indicate timeout;
Make the wait_on_bit_timeout() callers check for these values.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 1511cc75
...@@ -2221,9 +2221,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) ...@@ -2221,9 +2221,8 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
err = wait_on_bit_timeout(&data->flags, BTUSB_DOWNLOADING, err = wait_on_bit_timeout(&data->flags, BTUSB_DOWNLOADING,
TASK_INTERRUPTIBLE, TASK_INTERRUPTIBLE,
msecs_to_jiffies(5000)); msecs_to_jiffies(5000));
if (err == 1) { if (err == -EINTR) {
BT_ERR("%s: Firmware loading interrupted", hdev->name); BT_ERR("%s: Firmware loading interrupted", hdev->name);
err = -EINTR;
goto done; goto done;
} }
...@@ -2275,7 +2274,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) ...@@ -2275,7 +2274,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
TASK_INTERRUPTIBLE, TASK_INTERRUPTIBLE,
msecs_to_jiffies(1000)); msecs_to_jiffies(1000));
if (err == 1) { if (err == -EINTR) {
BT_ERR("%s: Device boot interrupted", hdev->name); BT_ERR("%s: Device boot interrupted", hdev->name);
return -EINTR; return -EINTR;
} }
......
...@@ -128,7 +128,7 @@ static int intel_wait_booting(struct hci_uart *hu) ...@@ -128,7 +128,7 @@ static int intel_wait_booting(struct hci_uart *hu)
TASK_INTERRUPTIBLE, TASK_INTERRUPTIBLE,
msecs_to_jiffies(1000)); msecs_to_jiffies(1000));
if (err == 1) { if (err == -EINTR) {
bt_dev_err(hu->hdev, "Device boot interrupted"); bt_dev_err(hu->hdev, "Device boot interrupted");
return -EINTR; return -EINTR;
} }
...@@ -151,7 +151,7 @@ static int intel_wait_lpm_transaction(struct hci_uart *hu) ...@@ -151,7 +151,7 @@ static int intel_wait_lpm_transaction(struct hci_uart *hu)
TASK_INTERRUPTIBLE, TASK_INTERRUPTIBLE,
msecs_to_jiffies(1000)); msecs_to_jiffies(1000));
if (err == 1) { if (err == -EINTR) {
bt_dev_err(hu->hdev, "LPM transaction interrupted"); bt_dev_err(hu->hdev, "LPM transaction interrupted");
return -EINTR; return -EINTR;
} }
...@@ -813,7 +813,7 @@ static int intel_setup(struct hci_uart *hu) ...@@ -813,7 +813,7 @@ static int intel_setup(struct hci_uart *hu)
err = wait_on_bit_timeout(&intel->flags, STATE_DOWNLOADING, err = wait_on_bit_timeout(&intel->flags, STATE_DOWNLOADING,
TASK_INTERRUPTIBLE, TASK_INTERRUPTIBLE,
msecs_to_jiffies(5000)); msecs_to_jiffies(5000));
if (err == 1) { if (err == -EINTR) {
bt_dev_err(hdev, "Firmware loading interrupted"); bt_dev_err(hdev, "Firmware loading interrupted");
err = -EINTR; err = -EINTR;
goto done; goto done;
......
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