[mle] simplify condition in Mle::BecomeDetached() (#10796)

This commit updates the skip condition in `BecomeDetached()` to use
positive boolean checks for improved readability. This condition
applies when the device is already detached and is about to start an
attach attempt.
This commit is contained in:
Abtin Keshavarzian
2024-10-08 14:37:30 -07:00
committed by GitHub
parent be74a3c035
commit c027237676
+6 -5
View File
@@ -501,11 +501,12 @@ Error Mle::BecomeDetached(void)
VerifyOrExit(!IsDisabled(), error = kErrorInvalidState);
// In case role is already detached and attach state is `kAttachStateStart`
// (i.e., waiting to start an attach attempt), there is no need to make any
// changes.
VerifyOrExit(!IsDetached() || mAttachState != kAttachStateStart);
if (IsDetached() && (mAttachState == kAttachStateStart))
{
// Already detached and waiting to start an attach attempt, so
// there is not need to make any changes.
ExitNow();
}
// Not in reattach stage after reset
if (mReattachState == kReattachStop)