From 21402549bec78e824f8fac8672ff9ad545e5d994 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Wed, 17 Apr 2024 16:12:48 -0500 Subject: [PATCH] Replace lambda function with memcmp --- src/platform/silabs/efr32/BLEManagerImpl.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/platform/silabs/efr32/BLEManagerImpl.cpp b/src/platform/silabs/efr32/BLEManagerImpl.cpp index 38536120a820f3..1f82f475c8bb4f 100644 --- a/src/platform/silabs/efr32/BLEManagerImpl.cpp +++ b/src/platform/silabs/efr32/BLEManagerImpl.cpp @@ -39,9 +39,9 @@ extern "C" { #include "sl_bt_stack_config.h" #include "sl_bt_stack_init.h" #include "timers.h" -#include #include #include +#include #include #include #include @@ -116,11 +116,8 @@ BLEManagerImpl BLEManagerImpl::sInstance; CHIP_ERROR BLEManagerImpl::_Init() { - CHIP_ERROR err; - // Initialize the CHIP BleLayer. - err = BleLayer::Init(this, this, &DeviceLayer::SystemLayer()); - SuccessOrExit(err); + ReturnErrorOnFailure(BleLayer::Init(this, this, &DeviceLayer::SystemLayer())); memset(mBleConnections, 0, sizeof(mBleConnections)); memset(mIndConfId, kUnusedIndex, sizeof(mIndConfId)); @@ -139,8 +136,8 @@ CHIP_ERROR BLEManagerImpl::_Init() // Check that an address was not already configured at boot. // This covers the init-shutdown-init case to comply with the BLE address change at boot only requirement - if (std::all_of(randomizedAddr.addr, randomizedAddr.addr + (sizeof(randomizedAddr.addr) / sizeof(uint8_t)), - [](uint8_t i) { return i == 0; })) + bd_addr temp = { 0 }; + if (memcmp(&randomizedAddr, &temp, sizeof(bd_addr)) == 0) { // Since a random address is not configured, configure one uint64_t random = Crypto::GetRandU64(); @@ -152,9 +149,7 @@ CHIP_ERROR BLEManagerImpl::_Init() } PlatformMgr().ScheduleWork(DriveBLEState, 0); - -exit: - return err; + return CHIP_NO_ERROR; } uint16_t BLEManagerImpl::_NumConnections(void)