drivers/bluetooth/hci_mrvl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
From: Gongwei Li <ligongwei@kylinos.cn>
wait_on_bit_timeout() returns 0 if the bit was cleared, -EINTR if the
process received a signal and the mode permitted wake up on that signal,
or -EAGAIN if the timeout elapsed. It never returns 1.
Hence the check "err == 1" in mrvl_load_firmware() is dead code: when
the waiting task is interrupted by a signal (-EINTR), the code falls
into the "else if (err)" branch and misreports it as "Firmware request
timeout" with -ETIMEDOUT instead of propagating -EINTR.
Fix this by testing for -EINTR so that an interrupted firmware load is
properly detected and reported.
Fixes: 162f812f23ba ("Bluetooth: hci_uart: Add Marvell support")
Signed-off-by: Gongwei Li <ligongwei@kylinos.cn>
---
drivers/bluetooth/hci_mrvl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bluetooth/hci_mrvl.c b/drivers/bluetooth/hci_mrvl.c
index 516b8f74c434..52badd1fe81a 100644
--- a/drivers/bluetooth/hci_mrvl.c
+++ b/drivers/bluetooth/hci_mrvl.c
@@ -307,7 +307,7 @@ static int mrvl_load_firmware(struct hci_dev *hdev, const char *name)
err = wait_on_bit_timeout(&mrvl->flags, STATE_FW_REQ_PENDING,
TASK_INTERRUPTIBLE,
msecs_to_jiffies(2000));
- if (err == 1) {
+ if (err == -EINTR) {
bt_dev_err(hdev, "Firmware load interrupted");
err = -EINTR;
break;
--
2.25.1
On Mon, Aug 24, 2026 at 9:13 AM Gongwei Li <13875017792@163.com> wrote:
>
> From: Gongwei Li <ligongwei@kylinos.cn>
>
> wait_on_bit_timeout() returns 0 if the bit was cleared, -EINTR if the
> process received a signal and the mode permitted wake up on that signal,
> or -EAGAIN if the timeout elapsed. It never returns 1.
>
> Hence the check "err == 1" in mrvl_load_firmware() is dead code: when
> the waiting task is interrupted by a signal (-EINTR), the code falls
> into the "else if (err)" branch and misreports it as "Firmware request
> timeout" with -ETIMEDOUT instead of propagating -EINTR.
>
> Fix this by testing for -EINTR so that an interrupted firmware load is
> properly detected and reported.
>
> Fixes: 162f812f23ba ("Bluetooth: hci_uart: Add Marvell support")
> Signed-off-by: Gongwei Li <ligongwei@kylinos.cn>
> ---
> drivers/bluetooth/hci_mrvl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/hci_mrvl.c b/drivers/bluetooth/hci_mrvl.c
> index 516b8f74c434..52badd1fe81a 100644
> --- a/drivers/bluetooth/hci_mrvl.c
> +++ b/drivers/bluetooth/hci_mrvl.c
> @@ -307,7 +307,7 @@ static int mrvl_load_firmware(struct hci_dev *hdev, const char *name)
> err = wait_on_bit_timeout(&mrvl->flags, STATE_FW_REQ_PENDING,
> TASK_INTERRUPTIBLE,
> msecs_to_jiffies(2000));
> - if (err == 1) {
> + if (err == -EINTR) {
> bt_dev_err(hdev, "Firmware load interrupted");
> err = -EINTR;
Then we can drop the above line.
> break;
> --
> 2.25.1
>
© 2016 - 2026 Red Hat, Inc.