From f4550dbda8dcff1525e8760f736726367fbd78b7 Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 20 Jun 2023 13:12:38 +0200 Subject: [PATCH] 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 --- subsys/bluetooth/audio/tbs_client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/bluetooth/audio/tbs_client.c b/subsys/bluetooth/audio/tbs_client.c index 52f844c783a..3f4c61acfa6 100644 --- a/subsys/bluetooth/audio/tbs_client.c +++ b/subsys/bluetooth/audio/tbs_client.c @@ -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; } }