Skip to content

Commit 2112c0b

Browse files
authored
nodiscard ChipError Batch project-chip#28: platform-specific src: tizen, zephyr, system (project-chip#42091)
* Batch project-chip#28 nodiscard errors: platform-specific src: tizen, zephyr, system * Fix CI failure * Apply review suggestion
1 parent 6a5cff3 commit 2112c0b

18 files changed

+80
-74
lines changed

src/platform/Tizen/BLEManagerImpl.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ void BLEManagerImpl::HandleAdvertisingTimeout(chip::System::Layer *, void * appS
167167
VerifyOrReturn(self->mFlags.Has(Flags::kFastAdvertisingEnabled));
168168

169169
ChipLogDetail(DeviceLayer, "bleAdv Timeout : Start slow advertisement");
170-
self->_SetAdvertisingMode(BLEAdvertisingMode::kSlowAdvertising);
170+
TEMPORARY_RETURN_IGNORED self->_SetAdvertisingMode(BLEAdvertisingMode::kSlowAdvertising);
171171
}
172172

173173
BLEManagerImpl::AdvertisingIntervals BLEManagerImpl::GetAdvertisingIntervals() const
@@ -300,23 +300,23 @@ void BLEManagerImpl::AdvertisingStateChangedCb(int result, bt_advertiser_h adver
300300
{
301301
mFlags.Set(Flags::kAdvertising);
302302
NotifyBLEPeripheralAdvStartComplete(CHIP_NO_ERROR);
303-
DeviceLayer::SystemLayer().ScheduleLambda([this] {
303+
TEMPORARY_RETURN_IGNORED DeviceLayer::SystemLayer().ScheduleLambda([this] {
304304
// Start a timer to make sure that the fast advertising is stopped after specified timeout.
305-
DeviceLayer::SystemLayer().StartTimer(kFastAdvertiseTimeout, HandleAdvertisingTimeout, this);
305+
TEMPORARY_RETURN_IGNORED DeviceLayer::SystemLayer().StartTimer(kFastAdvertiseTimeout, HandleAdvertisingTimeout, this);
306306
});
307307
}
308308
else
309309
{
310310
mFlags.Clear(Flags::kAdvertising);
311311
NotifyBLEPeripheralAdvStopComplete(CHIP_NO_ERROR);
312-
DeviceLayer::SystemLayer().ScheduleLambda(
312+
TEMPORARY_RETURN_IGNORED DeviceLayer::SystemLayer().ScheduleLambda(
313313
[this] { DeviceLayer::SystemLayer().CancelTimer(HandleAdvertisingTimeout, this); });
314314
}
315315

316316
if (mFlags.Has(Flags::kAdvertisingRefreshNeeded))
317317
{
318318
mFlags.Clear(Flags::kAdvertisingRefreshNeeded);
319-
DeviceLayer::SystemLayer().ScheduleLambda([this] { DriveBLEState(); });
319+
TEMPORARY_RETURN_IGNORED DeviceLayer::SystemLayer().ScheduleLambda([this] { DriveBLEState(); });
320320
}
321321

322322
mAdvReqInProgress = false;
@@ -480,14 +480,14 @@ void BLEManagerImpl::OnDeviceScanned(const bt_adapter_le_device_scan_result_info
480480
// StopScan should also be performed in the ChipStack thread.
481481
// At the same time, the scan timer also needs to be canceled in the ChipStack thread.
482482
DeviceLayer::SystemLayer().CancelTimer(HandleScanTimeout, this);
483-
mDeviceScanner.StopScan();
483+
TEMPORARY_RETURN_IGNORED mDeviceScanner.StopScan();
484484
// Stop scanning and then start connecting timer
485-
DeviceLayer::SystemLayer().StartTimer(kConnectTimeout, HandleConnectionTimeout, this);
485+
TEMPORARY_RETURN_IGNORED DeviceLayer::SystemLayer().StartTimer(kConnectTimeout, HandleConnectionTimeout, this);
486486
chip::DeviceLayer::PlatformMgr().UnlockChipStack();
487487

488488
/* Initiate Connect */
489489
auto params = std::make_pair(this, scanInfo.remote_address);
490-
PlatformMgrImpl().GLibMatterContextInvokeSync(
490+
TEMPORARY_RETURN_IGNORED PlatformMgrImpl().GLibMatterContextInvokeSync(
491491
+[](decltype(params) * aParams) { return aParams->first->ConnectChipThing(aParams->second); }, &params);
492492
}
493493

@@ -843,7 +843,7 @@ void BLEManagerImpl::RemoveConnection(const char * remoteAddr)
843843
// immediately, because the BLE layer might still use it. Instead, we will also
844844
// schedule the deletion of the connection object, so it will happen after the
845845
// BLE layer has processed the disconnection event.
846-
DeviceLayer::SystemLayer().ScheduleLambda([conn] {
846+
TEMPORARY_RETURN_IGNORED DeviceLayer::SystemLayer().ScheduleLambda([conn] {
847847
ChipLogDetail(DeviceLayer, "Freeing BLE connection");
848848
chip::Platform::Delete(conn);
849849
});
@@ -1271,7 +1271,8 @@ void BLEManagerImpl::NewConnection(BleLayer * bleLayer, void * appState, const S
12711271
}
12721272

12731273
// Scan initiation performed async, to ensure that the BLE subsystem is initialized.
1274-
DeviceLayer::SystemLayer().ScheduleLambda([this] { InitiateScan(BleScanState::kScanForDiscriminator); });
1274+
TEMPORARY_RETURN_IGNORED DeviceLayer::SystemLayer().ScheduleLambda(
1275+
[this] { InitiateScan(BleScanState::kScanForDiscriminator); });
12751276
}
12761277

12771278
void BLEManagerImpl::InitiateScan(BleScanState scanType)
@@ -1288,11 +1289,11 @@ void BLEManagerImpl::InitiateScan(BleScanState scanType)
12881289
/* Send StartScan Request to Scanner Class */
12891290
strcpy(data.service_uuid, Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR);
12901291
err = mDeviceScanner.StartScan(ScanFilterType::kServiceData, data);
1291-
VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(Ble, "Failed to start BLE scan: %" CHIP_ERROR_FORMAT, err.Format()));
1292+
SuccessOrExitAction(err, ChipLogFailure(err, Ble, "Failed to start BLE scan"));
12921293

12931294
err = DeviceLayer::SystemLayer().StartTimer(kNewConnectionScanTimeout, HandleScanTimeout, this);
1294-
VerifyOrExit(err == CHIP_NO_ERROR, mDeviceScanner.StopScan();
1295-
ChipLogError(Ble, "Failed to start BLE scan timeout: %" CHIP_ERROR_FORMAT, err.Format()));
1295+
SuccessOrExitAction(err, TEMPORARY_RETURN_IGNORED mDeviceScanner.StopScan();
1296+
ChipLogFailure(err, Ble, "Failed to start BLE scan timeout"));
12961297

12971298
mBLEScanConfig.mBleScanState = scanType;
12981299
return;
@@ -1306,7 +1307,7 @@ void BLEManagerImpl::HandleScanTimeout(chip::System::Layer *, void * appState)
13061307
{
13071308
auto * manager = static_cast<BLEManagerImpl *>(appState);
13081309
manager->OnScanError(CHIP_ERROR_TIMEOUT);
1309-
manager->mDeviceScanner.StopScan();
1310+
TEMPORARY_RETURN_IGNORED manager->mDeviceScanner.StopScan();
13101311
}
13111312

13121313
CHIP_ERROR BLEManagerImpl::CancelConnection()
@@ -1315,7 +1316,7 @@ CHIP_ERROR BLEManagerImpl::CancelConnection()
13151316
if (mBLEScanConfig.mBleScanState != BleScanState::kNotScanning)
13161317
{
13171318
DeviceLayer::SystemLayer().CancelTimer(HandleScanTimeout, this);
1318-
mDeviceScanner.StopScan();
1319+
TEMPORARY_RETURN_IGNORED mDeviceScanner.StopScan();
13191320
}
13201321
return CHIP_NO_ERROR;
13211322
}

src/platform/Tizen/ChipDeviceScanner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ CHIP_ERROR ChipDeviceScanner::StartScan(ScanFilterType filterType, const ScanFil
156156

157157
exit:
158158
ChipLogError(DeviceLayer, "Start CHIP Scan could not succeed fully! Stop Scan...");
159-
StopScan();
159+
TEMPORARY_RETURN_IGNORED StopScan();
160160
UnRegisterScanFilter();
161161
return err;
162162
}

src/platform/Tizen/ChipDeviceScanner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class ChipDeviceScanner
8080
{
8181
public:
8282
ChipDeviceScanner(ChipDeviceScannerDelegate * delegate) : mDelegate(delegate){};
83-
~ChipDeviceScanner() { StopScan(); }
83+
~ChipDeviceScanner() { TEMPORARY_RETURN_IGNORED StopScan(); }
8484

8585
/// Initiate a scan for devices, with the given scan filter data
8686
CHIP_ERROR StartScan(ScanFilterType filterType, const ScanFilterData & filterData);

src/platform/Tizen/ConnectivityManagerImpl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ bool ConnectivityManagerImpl::_IsWiFiStationEnabled()
167167
{
168168
bool isWiFiStationEnabled = false;
169169

170-
Internal::WiFiMgr().IsActivated(&isWiFiStationEnabled);
170+
TEMPORARY_RETURN_IGNORED Internal::WiFiMgr().IsActivated(&isWiFiStationEnabled);
171171

172172
return isWiFiStationEnabled;
173173
}
@@ -204,7 +204,7 @@ bool ConnectivityManagerImpl::_IsWiFiStationProvisioned()
204204

205205
void ConnectivityManagerImpl::_ClearWiFiStationProvision()
206206
{
207-
Internal::WiFiMgr().RemoveAllConfigs();
207+
TEMPORARY_RETURN_IGNORED Internal::WiFiMgr().RemoveAllConfigs();
208208
}
209209

210210
ConnectivityManager::WiFiAPMode ConnectivityManagerImpl::_GetWiFiAPMode()
@@ -232,18 +232,18 @@ void ConnectivityManagerImpl::_SetWiFiAPIdleTimeout(System::Clock::Timeout val)
232232

233233
void ConnectivityManagerImpl::StartWiFiManagement()
234234
{
235-
Internal::WiFiMgr().Activate();
235+
TEMPORARY_RETURN_IGNORED Internal::WiFiMgr().Activate();
236236
}
237237

238238
void ConnectivityManagerImpl::StopWiFiManagement()
239239
{
240-
Internal::WiFiMgr().Deactivate();
240+
TEMPORARY_RETURN_IGNORED Internal::WiFiMgr().Deactivate();
241241
}
242242

243243
bool ConnectivityManagerImpl::IsWiFiManagementStarted()
244244
{
245245
bool isActivated = false;
246-
Internal::WiFiMgr().IsActivated(&isActivated);
246+
TEMPORARY_RETURN_IGNORED Internal::WiFiMgr().IsActivated(&isActivated);
247247
return isActivated;
248248
}
249249

src/platform/Tizen/DnssdImpl.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void OnRegister(dnssd_error_e result, dnssd_service_h service, void * data)
9292
ChipLogError(DeviceLayer, "DNSsd %s: Error: %s", __func__, get_error_message(result));
9393
rCtx->mCallback(rCtx->mCbContext, nullptr, nullptr, TizenToChipError(result));
9494
// After this point, the context might be no longer valid
95-
rCtx->mInstance->RemoveContext(rCtx);
95+
TEMPORARY_RETURN_IGNORED rCtx->mInstance->RemoveContext(rCtx);
9696
return;
9797
}
9898

@@ -120,7 +120,7 @@ gboolean OnBrowseTimeout(void * userData)
120120
bCtx->mCallback(bCtx->mCbContext, bCtx->mServices.data(), bCtx->mServices.size(), true, CHIP_NO_ERROR);
121121

122122
// After this point the context might be no longer valid
123-
bCtx->mInstance->RemoveContext(bCtx);
123+
TEMPORARY_RETURN_IGNORED bCtx->mInstance->RemoveContext(bCtx);
124124

125125
// This is a one-shot timer
126126
return G_SOURCE_REMOVE;
@@ -213,7 +213,7 @@ void OnBrowse(dnssd_service_state_e state, dnssd_service_h service, void * data)
213213
{
214214
bCtx->mCallback(bCtx->mCbContext, nullptr, 0, true, TizenToChipError(ret));
215215
// After this point the context might be no longer valid
216-
bCtx->mInstance->RemoveContext(bCtx);
216+
TEMPORARY_RETURN_IGNORED bCtx->mInstance->RemoveContext(bCtx);
217217
}
218218
}
219219

@@ -347,7 +347,7 @@ void OnResolve(dnssd_error_e result, dnssd_service_h service, void * userData)
347347
ChipLogProgress(DeviceLayer, "DNSsd Handle resolve task on schedule lambda");
348348

349349
rCtx->Finalize(CHIP_NO_ERROR);
350-
rCtx->mInstance->RemoveContext(rCtx);
350+
TEMPORARY_RETURN_IGNORED rCtx->mInstance->RemoveContext(rCtx);
351351
});
352352
VerifyOrExit(err == CHIP_NO_ERROR,
353353
ChipLogError(DeviceLayer, "Failed to schedule resolve task: %" CHIP_ERROR_FORMAT, err.Format()));
@@ -356,7 +356,7 @@ void OnResolve(dnssd_error_e result, dnssd_service_h service, void * userData)
356356

357357
exit:
358358
rCtx->Finalize(ret != DNSSD_ERROR_NONE ? TizenToChipError(ret) : err);
359-
rCtx->mInstance->RemoveContext(rCtx);
359+
TEMPORARY_RETURN_IGNORED rCtx->mInstance->RemoveContext(rCtx);
360360
}
361361

362362
CHIP_ERROR ResolveAsync(chip::Dnssd::ResolveContext * rCtx)
@@ -585,7 +585,7 @@ CHIP_ERROR DnssdTizen::RegisterService(const DnssdService & service, DnssdPublis
585585
if (err != CHIP_NO_ERROR)
586586
{ // Notify caller about error
587587
callback(context, nullptr, nullptr, err);
588-
RemoveContext(serviceCtx);
588+
TEMPORARY_RETURN_IGNORED RemoveContext(serviceCtx);
589589
}
590590
return err;
591591
}
@@ -624,7 +624,7 @@ CHIP_ERROR DnssdTizen::Browse(const char * type, Dnssd::DnssdServiceProtocol pro
624624
if (err != CHIP_NO_ERROR)
625625
{ // Notify caller about error
626626
callback(context, nullptr, 0, true, err);
627-
RemoveContext(browseCtx);
627+
TEMPORARY_RETURN_IGNORED RemoveContext(browseCtx);
628628
}
629629
return err;
630630
}
@@ -646,7 +646,7 @@ CHIP_ERROR DnssdTizen::Resolve(const DnssdService & browseResult, chip::Inet::In
646646

647647
exit:
648648
if (err != CHIP_NO_ERROR)
649-
RemoveContext(resolveCtx);
649+
TEMPORARY_RETURN_IGNORED RemoveContext(resolveCtx);
650650
return err;
651651
}
652652

@@ -741,7 +741,7 @@ CHIP_ERROR ChipDnssdRemoveServices()
741741
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT
742742
if (DeviceLayer::ThreadStackMgr().IsThreadEnabled())
743743
{
744-
DeviceLayer::ThreadStackMgr().InvalidateAllSrpServices();
744+
TEMPORARY_RETURN_IGNORED DeviceLayer::ThreadStackMgr().InvalidateAllSrpServices();
745745
return DeviceLayer::ThreadStackMgr().RemoveInvalidSrpServices();
746746
}
747747
#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT

src/platform/Tizen/NetworkCommissioningThreadDriver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ CHIP_ERROR TizenThreadDriver::Init(BaseDriver::NetworkStatusChangeCallback * net
4040
VerifyOrReturnError(ConnectivityMgr().IsThreadAttached(), CHIP_NO_ERROR);
4141
VerifyOrReturnError(ThreadStackMgr().GetThreadProvision(mStagingNetwork) == CHIP_NO_ERROR, CHIP_NO_ERROR);
4242

43-
mSavedNetwork.Init(mStagingNetwork.AsByteSpan());
43+
TEMPORARY_RETURN_IGNORED mSavedNetwork.Init(mStagingNetwork.AsByteSpan());
4444

4545
return CHIP_NO_ERROR;
4646
}
@@ -64,7 +64,7 @@ Status TizenThreadDriver::AddOrUpdateNetwork(ByteSpan operationalDataset, Mutabl
6464
Thread::OperationalDataset newDataset;
6565
outDebugText.reduce_size(0);
6666
outNetworkIndex = 0;
67-
newDataset.Init(operationalDataset);
67+
TEMPORARY_RETURN_IGNORED newDataset.Init(operationalDataset);
6868
VerifyOrReturnError(newDataset.IsCommissioned(), Status::kOutOfRange);
6969

7070
VerifyOrReturnError(!mStagingNetwork.IsCommissioned() || memcmp(extpanid, newExtpanid, Thread::kSizeExtendedPanId) == 0,
@@ -179,7 +179,7 @@ ThreadCapabilities TizenThreadDriver::GetSupportedThreadFeatures()
179179
uint16_t TizenThreadDriver::GetThreadVersion()
180180
{
181181
uint16_t version = 0;
182-
DeviceLayer::ThreadStackMgr().GetThreadVersion(version);
182+
TEMPORARY_RETURN_IGNORED DeviceLayer::ThreadStackMgr().GetThreadVersion(version);
183183
return version;
184184
}
185185

src/platform/Tizen/ThreadStackManagerImpl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ CHIP_ERROR ThreadStackManagerImpl::_GetThreadProvision(Thread::OperationalDatase
305305
ChipLogError(DeviceLayer, "FAIL: Thread get active dataset TLVs: %s", get_error_message(threadErr)));
306306

307307
ChipLogProgress(DeviceLayer, "Thread get active dataset TLVs size [%u]", tlvsLen);
308-
mDataset.Init(ByteSpan(tlvsData, tlvsLen));
309-
dataset.Init(mDataset.AsByteSpan());
308+
TEMPORARY_RETURN_IGNORED mDataset.Init(ByteSpan(tlvsData, tlvsLen));
309+
TEMPORARY_RETURN_IGNORED dataset.Init(mDataset.AsByteSpan());
310310

311311
return CHIP_NO_ERROR;
312312

@@ -354,7 +354,7 @@ CHIP_ERROR ThreadStackManagerImpl::_SetThreadEnabled(bool val)
354354
if (val && !isEnabled)
355355
{
356356
threadErr = thread_network_attach(mThreadInstance);
357-
DeviceLayer::SystemLayer().ScheduleLambda([&, threadErr]() {
357+
TEMPORARY_RETURN_IGNORED DeviceLayer::SystemLayer().ScheduleLambda([&, threadErr]() {
358358
if (this->mpConnectCallback != nullptr && threadErr != THREAD_ERROR_NONE)
359359
{
360360
this->mpConnectCallback->OnResult(NetworkCommissioning::Status::kUnknownError, CharSpan(), 0);
@@ -365,7 +365,7 @@ CHIP_ERROR ThreadStackManagerImpl::_SetThreadEnabled(bool val)
365365
ChipLogError(DeviceLayer, "FAIL: Attach Thread network: %s", get_error_message(threadErr)));
366366

367367
threadErr = thread_start(mThreadInstance);
368-
DeviceLayer::SystemLayer().ScheduleLambda([&, threadErr]() {
368+
TEMPORARY_RETURN_IGNORED DeviceLayer::SystemLayer().ScheduleLambda([&, threadErr]() {
369369
if (this->mpConnectCallback != nullptr)
370370
{
371371
this->mpConnectCallback->OnResult(threadErr == THREAD_ERROR_NONE ? NetworkCommissioning::Status::kSuccess

src/platform/Tizen/WiFiManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ void WiFiManager::_ScanToConnectFinishedCb(wifi_manager_error_e wifiErr, void *
340340
foundAp = sInstance._WiFiGetFoundAP();
341341
if (foundAp != nullptr)
342342
{
343-
PlatformMgrImpl().GLibMatterContextInvokeSync(_WiFiConnect, foundAp);
343+
TEMPORARY_RETURN_IGNORED PlatformMgrImpl().GLibMatterContextInvokeSync(_WiFiConnect, foundAp);
344344
}
345345
}
346346
else
@@ -818,7 +818,7 @@ void WiFiManager::Init()
818818
sInstance.mModuleState = WIFI_MANAGER_MODULE_STATE_DETACHED;
819819
sInstance.mConnectionState = WIFI_MANAGER_CONNECTION_STATE_DISCONNECTED;
820820

821-
PlatformMgrImpl().GLibMatterContextInvokeSync(_WiFiInitialize, static_cast<void *>(nullptr));
821+
TEMPORARY_RETURN_IGNORED PlatformMgrImpl().GLibMatterContextInvokeSync(_WiFiInitialize, static_cast<void *>(nullptr));
822822
}
823823

824824
void WiFiManager::Deinit()

src/platform/Zephyr/BLEAdvertisingArbiter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void CancelRequest(Request & request)
142142
// If cancelled request was top-priority, restart the advertising.
143143
if (isTopPriority)
144144
{
145-
RestartAdvertising();
145+
TEMPORARY_RETURN_IGNORED RestartAdvertising();
146146
}
147147
}
148148

0 commit comments

Comments
 (0)