Skip to content
Commit 59b62243 authored by Alberto Escolar Piedras's avatar Alberto Escolar Piedras Committed by Benjamin Cabé
Browse files

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: default avatarAlberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
parent 83efaa7a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment