mirror of https://lore.kernel.org/lkml/
 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 14:30 ` patchwork-bot+bluetooth
  0 siblings, 1 reply; 2+ 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	[flat|nested] 2+ 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 14:30 ` patchwork-bot+bluetooth
  0 siblings, 0 replies; 2+ 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] 2+ messages in thread

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

Thread overview: 2+ 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 14:30 ` 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

all inboxes | Powered by JetHome®