[Invisalign2] Use btm_find_or_alloc_dev in btm_sec_connect_req
Bug: 301661850
Test: m com.android.btservices
Change-Id: I39ad73b83fdd4fa2eae840feb868fba7146cdd5a
diff --git a/system/stack/btm/btm_sec.cc b/system/stack/btm/btm_sec.cc
index cd707ce..9a43b71 100644
--- a/system/stack/btm/btm_sec.cc
+++ b/system/stack/btm/btm_sec.cc
@@ -2060,7 +2060,7 @@
*
******************************************************************************/
void btm_sec_conn_req(const RawAddress& bda, uint8_t* dc) {
- tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bda);
+ tBTM_SEC_DEV_REC* p_dev_rec = nullptr;
/* Some device may request a connection before we are done with the HCI_Reset
* sequence */
@@ -2086,10 +2086,7 @@
btm_sec_cb.connecting_bda = bda;
memcpy(btm_sec_cb.connecting_dc, dc, DEV_CLASS_LEN);
- if (!p_dev_rec) {
- /* accept the connection -> allocate a device record */
- p_dev_rec = btm_sec_alloc_dev(bda);
- }
+ p_dev_rec = btm_find_or_alloc_dev(bda);
p_dev_rec->sm4 |= BTM_SM4_CONN_PEND;
}