From 92d612e79d5eb9bd368da4a548b3ade47ebf779e Mon Sep 17 00:00:00 2001 From: Emil Gydesen Date: Tue, 20 Jun 2023 13:23:46 +0200 Subject: [PATCH] Bluetooth: VCP: Return if VOCS/AICS inst count is 0 In the prepare_aics_inst and prepare_vocs_inst the loops should not run if the count is 0. Signed-off-by: Emil Gydesen --- subsys/bluetooth/audio/vcp_vol_rend.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/subsys/bluetooth/audio/vcp_vol_rend.c b/subsys/bluetooth/audio/vcp_vol_rend.c index 51dab75b3d4..5e982a1db33 100644 --- a/subsys/bluetooth/audio/vcp_vol_rend.c +++ b/subsys/bluetooth/audio/vcp_vol_rend.c @@ -260,6 +260,10 @@ static int prepare_vocs_inst(struct bt_vcp_vol_rend_register_param *param) int j; int i; + if (CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT == 0) { + return 0; + } + __ASSERT(param, "NULL param"); for (j = 0, i = 0; i < ARRAY_SIZE(vcs_attrs); i++) { @@ -303,6 +307,10 @@ static int prepare_aics_inst(struct bt_vcp_vol_rend_register_param *param) int j; int i; + if (CONFIG_BT_VCP_VOL_REND_AICS_INSTANCE_COUNT == 0) { + return 0; + } + __ASSERT(param, "NULL param"); for (j = 0, i = 0; i < ARRAY_SIZE(vcs_attrs); i++) {