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 <tzungbi@kernel.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Tzung-Bi Shih 2026-09-14 09:46:31 +00:00 committed by Luiz Augusto von Dentz
parent 13095bb5ce
commit 3fe48c863a

View File

@ -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;
}