From 8e08097151c3401809e5f4658f0663f8726bc5b6 Mon Sep 17 00:00:00 2001 From: Yulong Date: Tue, 10 Oct 2017 02:29:54 -0400 Subject: [PATCH] component/bt: Fixed the bug when remove the bonded device with not exist address will not return error. --- components/bt/bluedroid/bta/dm/bta_dm_act.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/bt/bluedroid/bta/dm/bta_dm_act.c b/components/bt/bluedroid/bta/dm/bta_dm_act.c index 916547fd0..0f1b7568e 100644 --- a/components/bt/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/bluedroid/bta/dm/bta_dm_act.c @@ -646,8 +646,12 @@ void bta_dm_process_remove_device(BD_ADDR bd_addr) if (bta_dm_cb.p_sec_cback) { tBTA_DM_SEC sec_event; bdcpy(sec_event.link_down.bd_addr, bd_addr); - /* No connection, set status to success (acl disc code not valid) */ - sec_event.link_down.status = HCI_SUCCESS; + if (btm_find_dev(bd_addr) != NULL) { + /* No connection, set status to success (acl disc code not valid) */ + sec_event.link_down.status = HCI_SUCCESS; + } else { + sec_event.link_down.status = HCI_ERR_ILLEGAL_COMMAND; + } bta_dm_cb.p_sec_cback(BTA_DM_DEV_UNPAIRED_EVT, &sec_event); } }