diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index 6e34303f8..0719d5403 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -1097,9 +1097,13 @@ otError Mac::RadioTransmit(Frame *aSendFrame) SuccessOrExit(error = otPlatRadioTransmit(&GetInstance(), static_cast(aSendFrame))); - otLogWarnMac(GetInstance(), "otPlatRadioTransmit() failed with error %s", otThreadErrorToString(error)); - exit: + + if (error != OT_ERROR_NONE) + { + otLogWarnMac(GetInstance(), "otPlatRadioTransmit() failed with error %s", otThreadErrorToString(error)); + } + return error; } @@ -1119,9 +1123,13 @@ otError Mac::RadioReceive(uint8_t aChannel) SuccessOrExit(error = otPlatRadioReceive(&GetInstance(), aChannel)); - otLogWarnMac(GetInstance(), "otPlatRadioReceive() failed with error %s", otThreadErrorToString(error)); - exit: + + if (error != OT_ERROR_NONE) + { + otLogWarnMac(GetInstance(), "otPlatRadioReceive() failed with error %s", otThreadErrorToString(error)); + } + return error; } @@ -1146,11 +1154,16 @@ otError Mac::RadioSleep(void) } #endif + SuccessOrExit(error = otPlatRadioSleep(&GetInstance())); - otLogWarnMac(GetInstance(), "otPlatRadioSleep() failed with error %s", otThreadErrorToString(error)); - exit: + + if (error != OT_ERROR_NONE) + { + otLogWarnMac(GetInstance(), "otPlatRadioSleep() failed with error %s", otThreadErrorToString(error)); + } + return error; }