Skip to content

Commit 59b6224

Browse files
aescolarkartben
authored andcommitted
Bluetooth: HFP_AG: Initialize variable to avoid warning
gcc 11.4.0, seems to believe this variable may be used uninitialized, and warns about it (causing a test build failure due to warnings being treated as errors). Let's just initialize the variable to 0 to avoid the issue, as the cost is trivial. subsys/bluetooth/host/classic/hfp_ag.c: In function ‘bt_hfp_ag_vts_handler’: 1095 subsys/bluetooth/host/classic/hfp_ag.c:3091:17: error: ‘code’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 1096 3091 | bt_ag->transmit_dtmf_code(ag, code); 1097 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1098 The issue can be reproduced for ex. with: $ mkdir build ; cd build $ cmake -GNinja -DBOARD=native_sim/native/64 ../tests/bluetooth/shell \ -DCONF_FILE="prj_br.conf" $ ninja Signed-off-by: Alberto Escolar Piedras <[email protected]>
1 parent 83efaa7 commit 59b6224

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/bluetooth/host/classic/hfp_ag.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3062,7 +3062,7 @@ static int bt_hfp_ag_binp_handler(struct bt_hfp_ag *ag, struct net_buf *buf)
30623062
static int bt_hfp_ag_vts_handler(struct bt_hfp_ag *ag, struct net_buf *buf)
30633063
{
30643064
int err;
3065-
char code;
3065+
char code = 0;
30663066

30673067
if (!is_char(buf, '=')) {
30683068
return -ENOTSUP;

0 commit comments

Comments
 (0)