[PATCH 2/4] Bluetooth: btmtksdio: Fix runtime PM leak in btmtksdio_shutdown()

Wentao Liang vulab at iscas.ac.cn
Mon Sep 14 20:53:25 PDT 2026


btmtksdio_shutdown() takes a runtime PM reference with
pm_runtime_get_sync(bdev->dev), which leaves the device's usage
count incremented even when it fails.  If the WMT func-ctrl command
fails to send, mtk_hci_wmt_sync() returns a negative error and the
function returns immediately, skipping the pm_runtime_put_noidle()
at the ignore_wmt_cmd label, so the reference is leaked.

Drop the reference with pm_runtime_put_noidle() before returning
the error to keep the usage count balanced.

Fixes: 7f3c563c575e ("Bluetooth: btmtksdio: Add runtime PM support to SDIO based Bluetooth")
Cc: stable at vger.kernel.org
Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
---
 drivers/bluetooth/btmtksdio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index 243215a81fa7..dfb61653a878 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -1231,6 +1231,7 @@ static int btmtksdio_shutdown(struct hci_dev *hdev)
 	err = mtk_hci_wmt_sync(hdev, &wmt_params);
 	if (err < 0) {
 		bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)", err);
+		pm_runtime_put_noidle(bdev->dev);
 		return err;
 	}
 
-- 
2.34.1




More information about the linux-arm-kernel mailing list