Skip to content

Commit

Permalink
Bluetooth: GATT: Fix BT_GATT_AUTO_DISCOVER_CCC
Browse files Browse the repository at this point in the history
When using BT_GATT_AUTO_DISCOVER_CCC if the ccc_handle is not set
bt_gatt_subscribe would initiate a discovery to locate the CCC handle
but instead of awaiting it to complete the code does proceed to call
gatt_write_ccc even with ccc_handle being 0x0000 which is invalid.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
(cherry picked from commit 64cc5a3)
  • Loading branch information
Vudentz authored and petejohanson committed Jan 15, 2021
1 parent 56a0e20 commit 2227eb7
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions subsys/bluetooth/host/gatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -4096,10 +4096,7 @@ int bt_gatt_subscribe(struct bt_conn *conn,

#if defined(CONFIG_BT_GATT_AUTO_DISCOVER_CCC)
if (!params->ccc_handle) {
err = gatt_ccc_discover(conn, params);
if (err) {
return err;
}
return gatt_ccc_discover(conn, params);
}
#endif
err = gatt_write_ccc(conn, params->ccc_handle, params->value,
Expand Down

0 comments on commit 2227eb7

Please sign in to comment.