Skip to content

Commit

Permalink
[zephyr] Fixed error check in BLE manager impl (#37706)
Browse files Browse the repository at this point in the history
The error check for rand address generation is done after
the address is set, what is too late.
  • Loading branch information
kkasperczyk-no authored Feb 21, 2025
1 parent 2f36eba commit e42f992
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/platform/Zephyr/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,15 @@ int InitRandomStaticAddress(bool idPresent, int & id)
// generating the address
addr.type = BT_ADDR_LE_RANDOM;
error = sys_csrand_get(addr.a.val, sizeof(addr.a.val));
BT_ADDR_SET_STATIC(&addr.a);

if (error)
{
ChipLogError(DeviceLayer, "Failed to create BLE address: %d", error);
return error;
}

BT_ADDR_SET_STATIC(&addr.a);

if (!idPresent)
{
id = bt_id_create(&addr, nullptr);
Expand Down

0 comments on commit e42f992

Please sign in to comment.