Skip to content

Commit

Permalink
Bluetooth: TBS: Guard check for MAX_TBS_INSTANCES
Browse files Browse the repository at this point in the history
Add check for CONFIG_BT_TBS_CLIENT_MAX_TBS_INSTANCES > 1 before
comparing inst_cnt, as otherwise it was always false which
caused a coverity issue.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
  • Loading branch information
Thalley authored and carlescufi committed Jun 29, 2023
1 parent 90e3650 commit f4550db
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion subsys/bluetooth/audio/tbs_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,8 @@ static uint8_t primary_discover_tbs(struct bt_conn *conn, const struct bt_gatt_a
srv_inst->current_inst->start_handle = attr->handle + 1;
srv_inst->current_inst->end_handle = prim_service->end_handle;

if (srv_inst->inst_cnt < CONFIG_BT_TBS_CLIENT_MAX_TBS_INSTANCES) {
if (CONFIG_BT_TBS_CLIENT_MAX_TBS_INSTANCES > 1 &&
srv_inst->inst_cnt < CONFIG_BT_TBS_CLIENT_MAX_TBS_INSTANCES) {
return BT_GATT_ITER_CONTINUE;
}
}
Expand Down

0 comments on commit f4550db

Please sign in to comment.