From b9a586821e7478e4213f53dfc5524d90ce64768f Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Fri, 28 May 2021 13:27:27 +0200 Subject: [PATCH] Bluetooth: host: Log failure to initiatie security for bonded peer Log failure to initiatet security for bonded peer when GATT wants to initiate security for CCCs for the remote. Signed-off-by: Joakim Andersson --- subsys/bluetooth/host/gatt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index de2bf653551..ad877ca1a14 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -4849,7 +4849,12 @@ void bt_gatt_connected(struct bt_conn *conn) */ if (IS_ENABLED(CONFIG_BT_SMP) && bt_conn_get_security(conn) < data.sec) { - bt_conn_set_security(conn, data.sec); + int err = bt_conn_set_security(conn, data.sec); + + if (err) { + BT_WARN("Failed to set security for bonded peer (%d)", + err); + } } #if defined(CONFIG_BT_GATT_CLIENT)