All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_mrvl: Fix wrong return value check of wait_on_bit_timeout()
@ 2026-08-24  7:12 Gongwei Li
  2026-08-24  8:03 ` bluez.test.bot
  2026-08-24 12:25 ` [PATCH] " Loic Poulain
  0 siblings, 2 replies; 3+ messages in thread
From: Gongwei Li @ 2026-08-24  7:12 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Loic Poulain, linux-bluetooth, linux-kernel, Gongwei Li

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: Bluetooth: hci_mrvl: Fix wrong return value check of wait_on_bit_timeout()
  2026-08-24  7:12 [PATCH] Bluetooth: hci_mrvl: Fix wrong return value check of wait_on_bit_timeout() Gongwei Li
@ 2026-08-24  8:03 ` bluez.test.bot
  2026-08-24 12:25 ` [PATCH] " Loic Poulain
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-08-24  8:03 UTC (permalink / raw)
  To: linux-bluetooth, 13875017792

[-- Attachment #1: Type: text/plain, Size: 1945 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1150676

---Test result---

Test Summary:
CheckPatch                    PENDING   31.89 seconds
VerifyFixes                   PENDING   31.72 seconds
VerifySignedoff               PENDING   31.73 seconds
GitLint                       PENDING   32.84 seconds
SubjectPrefix                 PENDING   31.80 seconds
BuildKernel                   PASS      26.32 seconds
CheckAllWarning               PASS      28.81 seconds
CheckSparse                   PASS      27.40 seconds
BuildKernel32                 PASS      25.23 seconds
CheckKernelLLVM               SKIP      0.00 seconds
TestRunnerSetup               PENDING   496.43 seconds
IncrementalBuild              PENDING   55.68 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: VerifyFixes - PENDING
Desc: Verify Fixes tag format and validity
Output:

##############################
Test: VerifySignedoff - PENDING
Desc: Verify Signed-off-by chain
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: SubjectPrefix - PENDING
Desc: Check subject contains "Bluetooth" prefix
Output:

##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found
##############################
Test: TestRunnerSetup - PENDING
Desc: Setup kernel and bluez for test-runner
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



https://github.com/bluez/bluetooth-next/pull/642

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: hci_mrvl: Fix wrong return value check of wait_on_bit_timeout()
  2026-08-24  7:12 [PATCH] Bluetooth: hci_mrvl: Fix wrong return value check of wait_on_bit_timeout() Gongwei Li
  2026-08-24  8:03 ` bluez.test.bot
@ 2026-08-24 12:25 ` Loic Poulain
  1 sibling, 0 replies; 3+ messages in thread
From: Loic Poulain @ 2026-08-24 12:25 UTC (permalink / raw)
  To: Gongwei Li
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, linux-bluetooth,
	linux-kernel, Gongwei Li

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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-24 12:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24  7:12 [PATCH] Bluetooth: hci_mrvl: Fix wrong return value check of wait_on_bit_timeout() Gongwei Li
2026-08-24  8:03 ` bluez.test.bot
2026-08-24 12:25 ` [PATCH] " Loic Poulain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.