From 821e9f3c6a7e65441d72b194316ec5569eb5b45d Mon Sep 17 00:00:00 2001 From: ZhongYao Luo Date: Wed, 7 May 2025 11:29:58 +0800 Subject: [PATCH] Bluetooth: SDP: Don't clear l2cap chan on disconnect - Remove memset on bt_l2cap_br_chan during SDP disconnect to prevent overwriting resources (e.g., rtx_work) still in use by L2CAP, which handles channel cleanup itself. - Delete unused partial_resp_queue to clean up code. Signed-off-by: ZhongYao Luo --- subsys/bluetooth/host/classic/sdp.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/subsys/bluetooth/host/classic/sdp.c b/subsys/bluetooth/host/classic/sdp.c index 5c10f8b521a..6d6b983f694 100644 --- a/subsys/bluetooth/host/classic/sdp.c +++ b/subsys/bluetooth/host/classic/sdp.c @@ -63,7 +63,6 @@ LOG_MODULE_REGISTER(bt_sdp); struct bt_sdp { struct bt_l2cap_br_chan chan; - struct k_fifo partial_resp_queue; /* TODO: Allow more than one pending request */ }; @@ -165,11 +164,9 @@ static void bt_sdp_connected(struct bt_l2cap_chan *chan) struct bt_l2cap_br_chan, chan); - struct bt_sdp *sdp = CONTAINER_OF(ch, struct bt_sdp, chan); + struct bt_sdp *sdp __unused = CONTAINER_OF(ch, struct bt_sdp, chan); LOG_DBG("chan %p cid 0x%04x", ch, ch->tx.cid); - - k_fifo_init(&sdp->partial_resp_queue); } /** @brief Callback for SDP disconnection @@ -186,11 +183,9 @@ static void bt_sdp_disconnected(struct bt_l2cap_chan *chan) struct bt_l2cap_br_chan, chan); - struct bt_sdp *sdp = CONTAINER_OF(ch, struct bt_sdp, chan); + struct bt_sdp *sdp __unused = CONTAINER_OF(ch, struct bt_sdp, chan); LOG_DBG("chan %p cid 0x%04x", ch, ch->tx.cid); - - (void)memset(sdp, 0, sizeof(*sdp)); } /* @brief Creates an SDP PDU