Skip to content

Commit

Permalink
Bluetooth: TBS: Fix -Wsometimes-uninitialized warning
Browse files Browse the repository at this point in the history
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 <tomhughes@chromium.org>
  • Loading branch information
thughes authored and kartben committed Feb 11, 2025
1 parent 9fca7ee commit 8218bf6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/tbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ static bool valid_register_param(const struct bt_tbs_register_param *param)

int bt_tbs_register_bearer(const struct bt_tbs_register_param *param)
{
int ret;
int ret = -ENOEXEC;

CHECKIF(!valid_register_param(param)) {
LOG_DBG("Invalid parameters");
Expand Down

0 comments on commit 8218bf6

Please sign in to comment.