linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btmtksdio: Fix PM runtime reference leak in shutdown
@ 2026-09-14  9:47 Tzung-Bi Shih
  2026-09-14 11:21 ` bluez.test.bot
  2026-09-14 14:30 ` [PATCH] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Tzung-Bi Shih @ 2026-09-14  9:47 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, linux-bluetooth,
	linux-kernel, linux-mediatek, tzungbi, Sean Wang

In btmtksdio_shutdown(), pm_runtime_get_sync() is called at the
beginning of the function.  However, if sending the WMT function
control command fails later, the driver returns early.

It bypasses the corresponding pm_runtime_put_noidle() and
pm_runtime_disable() calls, leaking the PM usage counter and leaving PM
runtime enabled indefinitely.

Fall through to execute the PM runtime cleanup block even if WMT errors.

Fixes: 7f3c563c575e ("Bluetooth: btmtksdio: Add runtime PM support to SDIO based Bluetooth")
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
 drivers/bluetooth/btmtksdio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index fe4ca9395aa3..b7db15268904 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -1249,10 +1249,8 @@ static int btmtksdio_shutdown(struct hci_dev *hdev)
 	wmt_params.status = NULL;
 
 	err = mtk_hci_wmt_sync(hdev, &wmt_params);
-	if (err < 0) {
+	if (err < 0)
 		bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)", err);
-		return err;
-	}
 
 ignore_wmt_cmd:
 	pm_runtime_put_noidle(bdev->dev);
-- 
2.55.0.1007.g17ff1f9808-goog


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

* RE: Bluetooth: btmtksdio: Fix PM runtime reference leak in shutdown
  2026-09-14  9:47 [PATCH] Bluetooth: btmtksdio: Fix PM runtime reference leak in shutdown Tzung-Bi Shih
@ 2026-09-14 11:21 ` bluez.test.bot
  2026-09-14 14:30 ` [PATCH] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-09-14 11:21 UTC (permalink / raw)
  To: linux-bluetooth, tzungbi

[-- Attachment #1: Type: text/plain, Size: 1019 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/series/1164398/

---Test result---

Test Summary:
CheckPatch                    PASS      0.48 seconds
VerifyFixes                   PASS      0.09 seconds
VerifySignedoff               PASS      0.09 seconds
GitLint                       PASS      0.26 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      19.44 seconds
CheckAllWarning               PASS      24.61 seconds
CheckSparse                   PASS      24.88 seconds
BuildKernel32                 PASS      23.04 seconds
CheckKernelLLVM               PASS      20.67 seconds
TestRunnerSetup               PASS      486.33 seconds
IncrementalBuild              PASS      22.06 seconds



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

---
Regards,
Linux Bluetooth


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

* Re: [PATCH] Bluetooth: btmtksdio: Fix PM runtime reference leak in shutdown
  2026-09-14  9:47 [PATCH] Bluetooth: btmtksdio: Fix PM runtime reference leak in shutdown Tzung-Bi Shih
  2026-09-14 11:21 ` bluez.test.bot
@ 2026-09-14 14:30 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-09-14 14:30 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: marcel, luiz.dentz, matthias.bgg, angelogioacchino.delregno,
	linux-bluetooth, linux-kernel, linux-mediatek, sean.wang

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 14 Sep 2026 09:47:29 +0000 you wrote:
> In btmtksdio_shutdown(), pm_runtime_get_sync() is called at the
> beginning of the function.  However, if sending the WMT function
> control command fails later, the driver returns early.
> 
> It bypasses the corresponding pm_runtime_put_noidle() and
> pm_runtime_disable() calls, leaking the PM usage counter and leaving PM
> runtime enabled indefinitely.
> 
> [...]

Here is the summary with links:
  - Bluetooth: btmtksdio: Fix PM runtime reference leak in shutdown
    https://git.kernel.org/bluetooth/bluetooth-next/c/d8dd59bd6fd3

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-09-14 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14  9:47 [PATCH] Bluetooth: btmtksdio: Fix PM runtime reference leak in shutdown Tzung-Bi Shih
2026-09-14 11:21 ` bluez.test.bot
2026-09-14 14:30 ` [PATCH] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).