From aa4e6ac0ddedd3a1a3a30f0481ffec234fc9cd7c Mon Sep 17 00:00:00 2001 From: Olivier Lesage Date: Wed, 2 Jul 2025 08:03:14 +0200 Subject: [PATCH] bluetooth: host: Handle failure to disable scan when updating own_addr It wasn't taken into account that bt_le_scan_set_enable() has a return value. It's not likely that the controller rejects the command when BT_DEV_SCANNING is set, however. Signed-off-by: Olivier Lesage --- subsys/bluetooth/host/id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/id.c b/subsys/bluetooth/host/id.c index fedcab5d716..dca77cd0b05 100644 --- a/subsys/bluetooth/host/id.c +++ b/subsys/bluetooth/host/id.c @@ -2005,8 +2005,8 @@ int bt_id_set_adv_own_addr(struct bt_le_ext_adv *adv, uint32_t options, if (!IS_ENABLED(CONFIG_BT_PRIVACY) && !IS_ENABLED(CONFIG_BT_SCAN_WITH_IDENTITY) && dev_scanning) { - scan_disabled = true; - bt_le_scan_set_enable(BT_HCI_LE_SCAN_DISABLE); + err = bt_le_scan_set_enable(BT_HCI_LE_SCAN_DISABLE); + scan_disabled = err == 0; } /* If we are scanning with the identity address, it does