Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

authored by

Bart Van Assche and committed by
Marcel Holtmann
f0a70a04 1511cc75

+5 -6
+2 -3
drivers/bluetooth/btusb.c
··· 2221 2221 err = wait_on_bit_timeout(&data->flags, BTUSB_DOWNLOADING, 2222 2222 TASK_INTERRUPTIBLE, 2223 2223 msecs_to_jiffies(5000)); 2224 - if (err == 1) { 2224 + if (err == -EINTR) { 2225 2225 BT_ERR("%s: Firmware loading interrupted", hdev->name); 2226 - err = -EINTR; 2227 2226 goto done; 2228 2227 } 2229 2228 ··· 2274 2275 TASK_INTERRUPTIBLE, 2275 2276 msecs_to_jiffies(1000)); 2276 2277 2277 - if (err == 1) { 2278 + if (err == -EINTR) { 2278 2279 BT_ERR("%s: Device boot interrupted", hdev->name); 2279 2280 return -EINTR; 2280 2281 }
+3 -3
drivers/bluetooth/hci_intel.c
··· 128 128 TASK_INTERRUPTIBLE, 129 129 msecs_to_jiffies(1000)); 130 130 131 - if (err == 1) { 131 + if (err == -EINTR) { 132 132 bt_dev_err(hu->hdev, "Device boot interrupted"); 133 133 return -EINTR; 134 134 } ··· 151 151 TASK_INTERRUPTIBLE, 152 152 msecs_to_jiffies(1000)); 153 153 154 - if (err == 1) { 154 + if (err == -EINTR) { 155 155 bt_dev_err(hu->hdev, "LPM transaction interrupted"); 156 156 return -EINTR; 157 157 } ··· 813 813 err = wait_on_bit_timeout(&intel->flags, STATE_DOWNLOADING, 814 814 TASK_INTERRUPTIBLE, 815 815 msecs_to_jiffies(5000)); 816 - if (err == 1) { 816 + if (err == -EINTR) { 817 817 bt_dev_err(hdev, "Firmware loading interrupted"); 818 818 err = -EINTR; 819 819 goto done;