Bluetooth: TBS: Guard check for MAX_TBS_INSTANCES

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>
This commit is contained in:
Emil Gydesen 2023-06-20 13:12:38 +02:00 committed by Carles Cufí
commit f4550dbda8

View file

@ -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;
}
}