Skip to content

Commit 8218bf6

Browse files
thugheskartben
authored andcommitted
Bluetooth: TBS: Fix -Wsometimes-uninitialized warning
Building bluetooth.shell.audio.only_gtbs with clang warns: subsys/bluetooth/audio/tbs.c:1646:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (param->gtbs) { ^~~~~~~~~~~ subsys/bluetooth/audio/tbs.c:1667:9: note: uninitialized use occurs here return ret; ^~~ subsys/bluetooth/audio/tbs.c:1646:2: note: remove the 'if' if its condition is always true if (param->gtbs) { ^~~~~~~~~~~~~~~~~ subsys/bluetooth/audio/tbs.c:1626:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 Signed-off-by: Tom Hughes <[email protected]>
1 parent 9fca7ee commit 8218bf6

File tree

1 file changed

+1
-1
lines changed
  • subsys/bluetooth/audio

1 file changed

+1
-1
lines changed

Diff for: subsys/bluetooth/audio/tbs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,7 @@ static bool valid_register_param(const struct bt_tbs_register_param *param)
16231623

16241624
int bt_tbs_register_bearer(const struct bt_tbs_register_param *param)
16251625
{
1626-
int ret;
1626+
int ret = -ENOEXEC;
16271627

16281628
CHECKIF(!valid_register_param(param)) {
16291629
LOG_DBG("Invalid parameters");

0 commit comments

Comments
 (0)