Skip to content

Commit

Permalink
shell: Fix faulty error check in bt shell
Browse files Browse the repository at this point in the history
bt_addr_le_to_str returns a length of bytes needed
for string conversion, not an error code.

Signed-off-by: Lars Knudsen <[email protected]>
  • Loading branch information
larsgk authored and fabiobaltieri committed Jul 31, 2023
1 parent a7cf7eb commit 96bc04f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions subsys/bluetooth/shell/bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,8 @@ bool passes_scan_filter(const struct bt_le_scan_recv_info *info, const struct ne

if (scan_filter.addr_set) {
char le_addr[BT_ADDR_LE_STR_LEN] = {0};
int err;

err = bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr));
if (err != 0) {
shell_error(ctx_shell, "Failed to convert addr to string: %d", err);
return false;
}
bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr));

if (!is_substring(scan_filter.addr, le_addr)) {
return false;
Expand Down

0 comments on commit 96bc04f

Please sign in to comment.