[PATCH v1 1/2] Bluetooth: btmtksdio: Check function enabled before doing close

Luiz Augusto von Dentz luiz.dentz at gmail.com
Mon Apr 21 12:19:00 PDT 2025


Hi Chris,

On Mon, Apr 21, 2025 at 3:29 AM Chris Lu <chris.lu at mediatek.com> wrote:
>
> Check BTMTKSDIO_FUNC_ENABLED flag before doing close to prevent
> btmtksdio_close been called twice.
>
> Signed-off-by: Chris Lu <chris.lu at mediatek.com>

Please add Fixes tag.

> ---
>  drivers/bluetooth/btmtksdio.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
> index 566c136e83bf..3c66e3ee9834 100644
> --- a/drivers/bluetooth/btmtksdio.c
> +++ b/drivers/bluetooth/btmtksdio.c
> @@ -723,6 +723,10 @@ static int btmtksdio_close(struct hci_dev *hdev)
>  {
>         struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
>
> +       /* Skip btmtksdio_close if BTMTKSDIO_FUNC_ENABLED isn't set */
> +       if (!test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state))
> +               return 0;
> +
>         sdio_claim_host(bdev->func);
>
>         /* Disable interrupt */
> --
> 2.45.2
>


-- 
Luiz Augusto von Dentz



More information about the Linux-mediatek mailing list