mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
To: Myeonghun Pak <mhun512@gmail.com>,
	Amitkumar Karwar <amitkumar.karwar@nxp.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Ijae Kim <ae878000@gmail.com>,
	"zhaodongdong@kylinos.cn" <zhaodongdong@kylinos.cn>
Subject: [PATCH] Bluetooth: btnxpuart: unregister HCI device on probe failure
Date: Fri, 26 Jun 2026 09:06:56 +0000	[thread overview]
Message-ID: <AS4PR04MB96929E70BAAF5CCE83969D37E7EB2@AS4PR04MB9692.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20260626085506.37500-1-mhun512@gmail.com>

Hi Myeonghun,

Thank you for submitting this patch.

However, a similar patch is already in review and approved by me:
https://patchwork.kernel.org/project/bluetooth/patch/tencent_F2E2AF1B6F510577B10C6897ED768BBBAF07@qq.com/
It's awaiting Luiz's review and/or merge.


Hi Luiz,

Can you please review the patch mentioned in the URL above, from Zhao Dongdong? I have answered your review comment.
Thank you for your time and review.

Thanks,
Neeraj


> If hci_register_dev() succeeds but ps_setup() fails, nxp_serdev_probe() jumps
> to probe_fail and frees the HCI device without first unregistering it. The
> remove path unregisters the HCI device before freeing it, and the probe error
> path needs the same ordering once registration has succeeded.
> 
> Send failures after successful registration through a new label that calls
> hci_unregister_dev(), then fall through to the existing reset and free cleanup.
> Keep hci_register_dev() failures on the original path because the device was
> not registered in that case.
> 
> Fixes: 689ca16e5232 ("Bluetooth: NXP: Add protocol support for NXP
> Bluetooth chipsets")
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> ---
>  drivers/bluetooth/btnxpuart.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
> index e7036a48ce..6778b883ab 100644
> --- a/drivers/bluetooth/btnxpuart.c
> +++ b/drivers/bluetooth/btnxpuart.c
> @@ -1907,13 +1907,15 @@ static int nxp_serdev_probe(struct serdev_device
> *serdev)
>         }
> 
>         if (ps_setup(hdev))
> -               goto probe_fail;
> +               goto unregister_dev;
> 
>         hci_devcd_register(hdev, nxp_coredump, nxp_coredump_hdr,
>                            nxp_coredump_notify);
> 
>         return 0;
> 
> +unregister_dev:
> +       hci_unregister_dev(hdev);
>  probe_fail:
>         reset_control_assert(nxpdev->pdn);
>         hci_free_dev(hdev);
> --
> 2.53.0


  reply	other threads:[~2026-06-26  9:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26  8:55 Myeonghun Pak
2026-06-26  9:06 ` Neeraj Sanjay Kale [this message]
2026-06-26  9:10   ` Myeonghun Pak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS4PR04MB96929E70BAAF5CCE83969D37E7EB2@AS4PR04MB9692.eurprd04.prod.outlook.com \
    --to=neeraj.sanjaykale@nxp.com \
    --cc=ae878000@gmail.com \
    --cc=amitkumar.karwar@nxp.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=mhun512@gmail.com \
    --cc=zhaodongdong@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®