void avct_br_on_l2cap_error(uint16_t lcid, uint16_t result) {
tAVCT_BCB* p_lcb = avct_bcb_by_lcid(lcid);
+ if (p_lcb == nullptr) return;
/* store result value */
p_lcb->ch_result = result;
static void bnep_on_l2cap_error(uint16_t l2cap_cid, uint16_t result) {
tBNEP_CONN* p_bcb = bnepu_find_bcb_by_cid(l2cap_cid);
+ if (p_bcb == nullptr) return;
/* Tell the upper layer, if there is a callback */
if ((p_bcb->con_flags & BNEP_FLAGS_IS_ORIG) && (bnep_cb.p_conn_state_cb)) {
static void gap_on_l2cap_error(uint16_t l2cap_cid, uint16_t result) {
tGAP_CCB* p_ccb = gap_find_ccb_by_cid(l2cap_cid);
+ if (p_ccb == nullptr) return;
/* Tell the user if there is a callback */
if (p_ccb->p_callback)
static void gatt_on_l2cap_error(uint16_t lcid, uint16_t result) {
tGATT_TCB* p_tcb = gatt_find_tcb_by_cid(lcid);
+ if (p_tcb == nullptr) return;
if (gatt_get_ch_state(p_tcb) == GATT_CH_CONN) {
gatt_cleanup_upon_disc(p_tcb->peer_bda, result, BT_TRANSPORT_BR_EDR);
} else {
void rfc_on_l2cap_error(uint16_t lcid, uint16_t result) {
tRFC_MCB* p_mcb = rfc_find_lcid_mcb(lcid);
+ if (p_mcb == nullptr) return;
if (result == L2CAP_CONN_OTHER_ERROR) {
RFCOMM_TRACE_DEBUG(
static void sdp_on_l2cap_error(uint16_t l2cap_cid, uint16_t result) {
tCONN_CB* p_ccb = sdpu_find_ccb_by_cid(l2cap_cid);
+ if (p_ccb == nullptr) return;
sdp_disconnect(p_ccb, SDP_CFG_FAILED);
}