From: "Li Youhong" <dayou5941@163.com>
To: marcel@holtmann.org, luiz.dentz@gmail.com
Cc: linux-bluetooth@vger.kernel.org, Li Youhong <liyouhong@kylinos.cn>
Subject: [PATCH] Bluetooth: hci_ll: check clk_prepare_enable() return value
Date: Fri, 28 Aug 2026 15:23:49 +0800 [thread overview]
Message-ID: <20260828072349.217999-1-dayou5941@163.com> (raw)
From: Li Youhong <liyouhong@kylinos.cn>
ll_open() ignored clk_prepare_enable() failures for the optional
external clock and still reported success. Propagate the error and
free the privately allocated protocol state on failure.
Signed-off-by: Li Youhong <liyouhong@kylinos.cn>
---
drivers/bluetooth/hci_ll.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index ab744001dafc..c2dca22d1eee 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -112,6 +112,7 @@ static int send_hcill_cmd(u8 cmd, struct hci_uart *hu)
static int ll_open(struct hci_uart *hu)
{
struct ll_struct *ll;
+ int err;
BT_DBG("hu %p", hu);
@@ -130,8 +131,14 @@ static int ll_open(struct hci_uart *hu)
if (hu->serdev) {
struct ll_device *lldev = serdev_device_get_drvdata(hu->serdev);
- if (!IS_ERR(lldev->ext_clk))
- clk_prepare_enable(lldev->ext_clk);
+ if (!IS_ERR(lldev->ext_clk)) {
+ err = clk_prepare_enable(lldev->ext_clk);
+ if (err) {
+ hu->priv = NULL;
+ kfree(ll);
+ return err;
+ }
+ }
}
return 0;
--
2.25.1
next reply other threads:[~2026-08-28 7:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 7:23 Li Youhong [this message]
2026-08-28 12:12 ` Bluetooth: hci_ll: check clk_prepare_enable() return value bluez.test.bot
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=20260828072349.217999-1-dayou5941@163.com \
--to=dayou5941@163.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=liyouhong@kylinos.cn \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
/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