From 3786334414347420f70e51eae7e69fed915ee010 Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Mon, 31 Aug 2020 13:00:09 -0700 Subject: [PATCH] Simplify return value btm_ble_read_resolving_list_entry Return value too complicated. Heck, it's not even checked in the single call location Towards readable code Bug: 163134718 Tag: #refactor Test: compile & verify basic functions working Change-Id: Id08da2a6f2e16da18c12477b00b112c65ac02543 --- stack/btm/btm_ble_privacy.cc | 13 ++++++++----- stack/btm/btm_int.h | 3 +-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/stack/btm/btm_ble_privacy.cc b/stack/btm/btm_ble_privacy.cc index 4af2d6369..c1fe9b15c 100644 --- a/stack/btm/btm_ble_privacy.cc +++ b/stack/btm/btm_ble_privacy.cc @@ -466,12 +466,15 @@ void btm_ble_clear_resolving_list(void) { * * Parameters entry index. * - * Returns status + * Returns true if command successfully sent, false otherwise * ******************************************************************************/ -tBTM_STATUS btm_ble_read_resolving_list_entry(tBTM_SEC_DEV_REC* p_dev_rec) { - if (!(p_dev_rec->ble.in_controller_list & BTM_RESOLVING_LIST_BIT)) - return BTM_WRONG_MODE; +bool btm_ble_read_resolving_list_entry(tBTM_SEC_DEV_REC* p_dev_rec) { + if (!(p_dev_rec->ble.in_controller_list & BTM_RESOLVING_LIST_BIT)) { + LOG_INFO("%s Unable to read resolving list entry as resolving bit not set", + __func__); + return false; + } if (controller_get_interface()->supports_ble_privacy()) { btsnd_hcic_ble_read_resolvable_addr_peer(p_dev_rec->ble.identity_addr_type, @@ -490,7 +493,7 @@ tBTM_STATUS btm_ble_read_resolving_list_entry(tBTM_SEC_DEV_REC* p_dev_rec) { btm_ble_enq_resolving_list_pending(p_dev_rec->bd_addr, BTM_BLE_META_READ_IRK_ENTRY); - return BTM_CMD_STARTED; + return true; } /******************************************************************************* diff --git a/stack/btm/btm_int.h b/stack/btm/btm_int.h index bcae9f065..facb344ca 100644 --- a/stack/btm/btm_int.h +++ b/stack/btm/btm_int.h @@ -122,8 +122,7 @@ extern void btm_read_local_name_complete(uint8_t* p, uint16_t evt_len); extern void btm_ble_create_conn_cancel_complete(uint8_t* p); extern bool btm_ble_addr_resolvable(const RawAddress& rpa, tBTM_SEC_DEV_REC* p_dev_rec); -extern tBTM_STATUS btm_ble_read_resolving_list_entry( - tBTM_SEC_DEV_REC* p_dev_rec); +extern bool btm_ble_read_resolving_list_entry(tBTM_SEC_DEV_REC* p_dev_rec); extern bool btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC* p_dev_rec); extern void btm_ble_resolving_list_remove_dev(tBTM_SEC_DEV_REC* p_dev_rec); -- 2.11.0