From 3fe48c863a145738720f37a1309643c84b39b06d Mon Sep 17 00:00:00 2001 From: Tzung-Bi Shih Date: Mon, 14 Sep 2026 09:46:31 +0000 Subject: [PATCH] Bluetooth: btmtksdio: Fix spurious ownership error logs In btmtksdio_fw_pmctrl(), if an early operation fails (like clearing the mailbox ACK), it jumps to the `out:` label and spuriously prints "Cannot return ownership to device". Evaluate the ownership return errors locally to ensure the error log is only printed if the actual ownership transaction fails. Signed-off-by: Tzung-Bi Shih Signed-off-by: Luiz Augusto von Dentz --- drivers/bluetooth/btmtksdio.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c index f7bdaebf660d..b9563df72983 100644 --- a/drivers/bluetooth/btmtksdio.c +++ b/drivers/bluetooth/btmtksdio.c @@ -378,17 +378,13 @@ static int btmtksdio_fw_pmctrl(struct btmtksdio_dev *bdev) /* Return ownership to the device */ sdio_writel(bdev->func, C_FW_OWN_REQ_SET, MTK_REG_CHLPCR, &err); - if (err < 0) - goto out; - - err = readx_poll_timeout(btmtksdio_drv_own_query, bdev, status, - !(status & C_COM_DRV_OWN), 2000, 1000000); - -out: - sdio_release_host(bdev->func); - + if (err == 0) + err = readx_poll_timeout(btmtksdio_drv_own_query, bdev, status, + !(status & C_COM_DRV_OWN), 2000, 1000000); if (err < 0) bt_dev_err(bdev->hdev, "Cannot return ownership to device"); +out: + sdio_release_host(bdev->func); return err; }