Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_ll: check clk_prepare_enable() return value
@ 2026-08-28  7:23 Li Youhong
  2026-08-28 12:12 ` bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Li Youhong @ 2026-08-28  7:23 UTC (permalink / raw)
  To: marcel, luiz.dentz; +Cc: linux-bluetooth, Li Youhong

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-28 12:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28  7:23 [PATCH] Bluetooth: hci_ll: check clk_prepare_enable() return value Li Youhong
2026-08-28 12:12 ` bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox