Skip to content

Commit 14fe06e

Browse files
thugheskartben
authored andcommitted
Bluetooth: ISO: Fix -Wsometimes-uninitialized warning
Building sample.bluetooth.tmap_central with clang warns: subsys/bluetooth/host/iso.c:2194:6: error: variable 'rsp' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (!advanced) { ^~~~~~~~~ subsys/bluetooth/host/iso.c:2202:6: note: uninitialized use occurs here if (rsp == NULL) { ^~~ subsys/bluetooth/host/iso.c:2194:2: note: remove the 'if' if its condition is always true if (!advanced) { ^~~~~~~~~~~~~~~ subsys/bluetooth/host/iso.c:2137:21: note: initialize the variable 'rsp' to silence this warning struct net_buf *rsp; ^ = NULL subsys/bluetooth/host/iso.c:2295:6: error: variable 'rsp' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (!advanced) { ^~~~~~~~~ subsys/bluetooth/host/iso.c:2303:6: note: uninitialized use occurs here if (rsp == NULL) { ^~~ subsys/bluetooth/host/iso.c:2295:2: note: remove the 'if' if its condition is always true if (!advanced) { ^~~~~~~~~~~~~~~ subsys/bluetooth/host/iso.c:2258:21: note: initialize the variable 'rsp' to silence this warning struct net_buf *rsp; ^ = NULL Signed-off-by: Tom Hughes <[email protected]>
1 parent 8c82d00 commit 14fe06e

File tree

1 file changed

+2
-2
lines changed
  • subsys/bluetooth/host

1 file changed

+2
-2
lines changed

subsys/bluetooth/host/iso.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ static bool valid_cig_param(const struct bt_iso_cig_param *param, bool advanced,
21342134
int bt_iso_cig_create(const struct bt_iso_cig_param *param, struct bt_iso_cig **out_cig)
21352135
{
21362136
int err;
2137-
struct net_buf *rsp;
2137+
struct net_buf *rsp = NULL;
21382138
struct bt_iso_cig *cig;
21392139
struct bt_hci_rp_le_set_cig_params *cig_rsp;
21402140
struct bt_iso_chan *cis;
@@ -2255,7 +2255,7 @@ int bt_iso_cig_reconfigure(struct bt_iso_cig *cig, const struct bt_iso_cig_param
22552255
struct bt_hci_rp_le_set_cig_params *cig_rsp;
22562256
uint8_t existing_num_cis;
22572257
bool advanced = false;
2258-
struct net_buf *rsp;
2258+
struct net_buf *rsp = NULL;
22592259
int err;
22602260

22612261
CHECKIF(cig == NULL) {

0 commit comments

Comments
 (0)