From 3b18048449cf408ba8e492a5a7862438faa22144 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Fri, 25 Sep 2020 16:37:51 -0700 Subject: [PATCH] Simplify bnep_on_l2cap_error Both cases are doing the same thing. Error reason isn't used throughout the stack. Bug: 159815595 Tag: #refactor Test: compile & verify basic functions working Change-Id: Ib3793f96c0d8a2907fc41d9a24712d2db78a0665 --- stack/bnep/bnep_main.cc | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/stack/bnep/bnep_main.cc b/stack/bnep/bnep_main.cc index 938dcca29..6681e092c 100644 --- a/stack/bnep/bnep_main.cc +++ b/stack/bnep/bnep_main.cc @@ -137,28 +137,15 @@ static void bnep_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid, 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->con_state == BNEP_STATE_CONN_START) { - BNEP_TRACE_WARNING("BNEP - Rcvd conn cnf with error: 0x%x CID 0x%x", - result, p_bcb->l2cap_cid); - - /* Tell the upper layer, if there is a callback */ - if (bnep_cb.p_conn_state_cb && p_bcb->con_flags & BNEP_FLAGS_IS_ORIG) { - (*bnep_cb.p_conn_state_cb)(p_bcb->handle, p_bcb->rem_bda, - BNEP_CONN_FAILED, false); - } - - bnepu_release_bcb(p_bcb); - } else { - /* Tell the upper layer, if there is a callback */ - if ((p_bcb->con_flags & BNEP_FLAGS_IS_ORIG) && (bnep_cb.p_conn_state_cb)) { - (*bnep_cb.p_conn_state_cb)(p_bcb->handle, p_bcb->rem_bda, - BNEP_CONN_FAILED_CFG, false); - } + /* Tell the upper layer, if there is a callback */ + if ((p_bcb->con_flags & BNEP_FLAGS_IS_ORIG) && (bnep_cb.p_conn_state_cb)) { + (*bnep_cb.p_conn_state_cb)(p_bcb->handle, p_bcb->rem_bda, BNEP_CONN_FAILED, + false); + } - L2CA_DisconnectReq(p_bcb->l2cap_cid); + L2CA_DisconnectReq(p_bcb->l2cap_cid); - bnepu_release_bcb(p_bcb); - } + bnepu_release_bcb(p_bcb); } /******************************************************************************* -- 2.11.0